Rails + Oracle problems


#1

I’m having a problem getting Rails to connect to my Oracle database.
I have Ruby/Rails installed on a SunOS (sun0) and my Oracle database
(mydb) is installed on another SunOS (sun1). sun1 has the Oracle
instant client on it, and I can run a simple ruby script to execute
queries just fine:

#!/usr/local/bin/ruby
require ‘oci8’

conn = OCI8.new(‘user’, ‘pass’, ‘//sun0:3333/mydb’)
conn.exec(‘select count(*) from t_mytest’) do |row|
puts row
end

This runs with no problem. Now comes my Rails issues. I’ve setup a
simple Rails project and in my database.yml file, I swear I’ve tried
every configuration I can, but the ‘rake migrate’ command still won’t
work. Here’s what my database.yml file looks like:

development:
adapter: oci
username: user
password: pass
database: //sun0:3333/mydb

development:
adapter: oci
username: user
password: pass
database: //sun0:3333/mydb

development:
adapter: oci
username: user
password: pass
database: //sun0:3333/mydb

I’ve seen some folks saying the ‘database’ line in database.yml isn’t
read, and I’ve tried it also with the host line in there. But alas,
it still doesn’t work. Any ideas?

reacher


#2

I guess I should mention the error I am getting. When run with the
above configuration, rake migrate produces:

rake aborted!
ORA-12162: TNS:net service name is incorrectly specified

If i remove the database: line in database.yml and include this line:

host: sun0

then rake migrate produces:

rake aborted!
ORA-12452: TNS:no listener