# Ruby on Rails and Oracle

**URL:** <https://www.ruby-forum.com/t/ruby-on-rails-and-oracle/118102>\
**Category:** Rails\
**Created:** [October 23, 2007, 9:59pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-oracle/118102 "2007-10-23T21:59:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a698b9/32.png) [@eder](https://www.ruby-forum.com/u/eder)\
**Post date:** [October 23, 2007, 9:59pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-oracle/118102/1 "2007-10-23T21:59:26Z")

</div>

Hello, I’m having a trouble when I try to connect RoR and Oracle.  
I believe that it has something to do with database.yml, this is how my  
database.yml looks:  
development:  
adapter: oci  
database: 127.0.0.1:1521/XE  
username: system  
password: y1984nip0359  
host: 127.0.0.1

And this is the Error that i get:

→ [http://127.0.0.1:3000/blog](http://127.0.0.1:3000/blog)

OCIError in BlogController#index

ORA-12514: TNS:listener does not currently know of service requested in  
connect descriptor

RAILS\_ROOT: C:/ruby/bin/blog/script/…/config/…  
Application Trace | Framework Trace | Full Trace

env.c:257:in oci8lib.so

Any help?

---

<div class="post-metadata">

**Author:** ![eder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a698b9/32.png) [@eder](https://www.ruby-forum.com/u/eder)\
**Post date:** [October 23, 2007, 10:10pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-oracle/118102/2 "2007-10-23T22:10:17Z")

</div>

Hi Eder,

I just wrote a not-so-small Rails app with Oracle and had quite some  
trouble setting it up, but since then it works flawlessly.

> database.yml looks:  
> development:  
> adapter: oci  
> database: 127.0.0.1:1521/XE  
> username: system  
> password: y1984nip0359  
> host: 127.0.0.1

This is mine:

development:  
adapter: oracle  
database: [//localhost:1521/XE](https://localhost:1521/XE)  
username: seek-rat  
password: seek-rat

You could maybe try to change the adapter to oracle.  
What’s your version of Rails?  
And the version of your Oracle driver (I had to fiddle around with that  
quite a bit, though it was under linux)

> ORA-12514: TNS:listener does not currently know of service requested in  
> connect descriptor

Are you sure you can connect with the same credentials from Oracle  
sql-developer (or any other tool creating a connection to the DB)? If  
yes, probably your ruby-oracle driver has some problems…

Cheers,  
Peter

* * *

[http://www.rubyrailways.com](http://www.rubyrailways.com)  
[http://scrubyt.org](http://scrubyt.org)

---

<div class="post-metadata">

**Author:** ![eder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a698b9/32.png) [@eder](https://www.ruby-forum.com/u/eder)\
**Post date:** [October 23, 2007, 10:21pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-oracle/118102/3 "2007-10-23T22:21:26Z")

</div>

On 10/23/07, Eder Quiñones [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello, I’m having a trouble when I try to connect RoR and Oracle.  
> I believe that it has something to do with database.yml, this is how my  
> database.yml looks:  
> development:  
> adapter: oci  
> database: 127.0.0.1:1521/XE  
> username: system  
> password: y1984nip0359  
> host: 127.0.0.1

This is mine:

development:  
adapter: oracle  
database: 127.0.0.1/XE  
username: myapp\_dev  
password: changeme

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![eder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a698b9/32.png) [@eder](https://www.ruby-forum.com/u/eder)\
**Post date:** [October 24, 2007, 12:02am UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-oracle/118102/4 "2007-10-24T00:02:39Z")

</div>

All of these look odd to me. How is your Oracle networking set up? Do  
you  
have a tnsnames.ora file? For ‘database’, I use the connection name from  
my  
tnsnames.ora file.

foo\_dev:  
adapter: oracle  
database: PROD  
username: foo  
password: foopass

–  
Cynthia K.
