I've started to use Rails migrations recently connecting to an Oracle database.
After reading many examples of how to configure the database.yml file on the Rails wiki (as well as ones from Oracle's own website), I ended up with something like:
This worked fine, but after researching other migration-related topics I read that
oci was the 'old' way to connect to Oracle, the 'new' adapter to use is
A tutorial from Oracle showing usage of the new 'oracle' adapter (scroll down to the section entitled "Part 1: Of configuration, Cursors, and Rows") suggested that your config should look like this:
Note: DEBIAN was the name of their TNS entry specified in their local tnsadmin.ora file.
I didn't want to use a reference to a local tnsadmin.ora file on my machine, I wanted to specify the host and SID explicitly. After many failed attempts at specifying this in different formats I happened across this Rails patch ticket regarding the change from 'oci' to 'oracle' - the winning clue was:
To use the adapter with it's new name, simply change your database.yml file to include:
database: <your db name here>
Note that database is now used instead of host.
So the problem was that I was entering the database server details in the host field (like all the examples said to) but for a non-TNS named server you need to use the database field.
My fully working Oracle database.yml config entry now looks like this:
Technorati Tags: Ruby, Rails, Oracle, OCI, database.yml, Andrew Beacockdevelopment: