Rails Oracle connection


#1

I’m using the following configuration in the database.yml to connect to
Oracle,
however I could not connect while the settings seems to be correct:

development_oracle:
adapter: oci
host: 127.0.0.1:8080/XE
username: rubydb
password: rubyrails

What is wrong here?

Can anyonbe help me?


#2

Hey Tom,

Try setting up a TNSNAMES.ORA file.

It should look something like this:

XE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 8080))
)
(CONNECT_DATA =
(SID = XE)
(SERVER = DEDICATED)
)
)

Then in your database.yml you put:

development:
adapter: oci
host: xe
username: rubydb
password: rubyrails

You’ll have to look up where in your installation the TNSNAMES.ORA
file should live, but this solution works like a charm for me.

-wilig


#3

William G. wrote:

Hey Tom,

Try setting up a TNSNAMES.ORA file.

It should look something like this:

XE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 8080))
)
(CONNECT_DATA =
(SID = XE)
(SERVER = DEDICATED)
)
)

Then in your database.yml you put:

development:
adapter: oci
host: xe
username: rubydb
password: rubyrails

You’ll have to look up where in your installation the TNSNAMES.ORA
file should live, but this solution works like a charm for me.

-wilig

Hi Willig,

Thank you for your help!
I works now just fine