# Rails + Oracle problems

**URL:** <https://www.ruby-forum.com/t/rails-oracle-problems/92551>\
**Category:** Rails\
**Created:** [April 20, 2007, 4:43pm UTC](https://www.ruby-forum.com/t/rails-oracle-problems/92551 "2007-04-20T16:43:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![reacher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/0ea827/32.png) [@reacher](https://www.ruby-forum.com/u/reacher)\
**Post date:** [April 20, 2007, 4:43pm UTC](https://www.ruby-forum.com/t/rails-oracle-problems/92551/1 "2007-04-20T16:43:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![reacher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/0ea827/32.png) [@reacher](https://www.ruby-forum.com/u/reacher)\
**Post date:** [April 20, 2007, 4:53pm UTC](https://www.ruby-forum.com/t/rails-oracle-problems/92551/2 "2007-04-20T16:53:24Z")

</div>

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
