# Problems connecting to remote Oracle DB on windows using active record

**URL:** <https://www.ruby-forum.com/t/problems-connecting-to-remote-oracle-db-on-windows-using-active-record/120295>\
**Category:** Rails\
**Created:** [November 15, 2007, 4:20pm UTC](https://www.ruby-forum.com/t/problems-connecting-to-remote-oracle-db-on-windows-using-active-record/120295 "2007-11-15T16:20:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 15, 2007, 4:20pm UTC](https://www.ruby-forum.com/t/problems-connecting-to-remote-oracle-db-on-windows-using-active-record/120295/1 "2007-11-15T16:20:00Z")

</div>

I am trying to connect to an older oracle DB remotely, I think version  
8 or 9. I downloaded the instant client stuff from oracle and copied  
oci.dll and oraociei10.dll to my windows/system folder (windows XP) I  
get the error.

C:\rb-play\>ar\_connect\_ss.rb  
env.c:257:in oci8lib.so: ORA-12514: TNS:listener does not currently  
know of serv  
ice requested in connect descriptor (OCIError)  
from c:/ruby/lib/ruby/site\_ruby/1.8/oci8.rb:228:in  
`initialize' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_recor d/connection_adapters/oracle_adapter.rb:585:in `new’  
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/  
active\_rec

If I change the adapter to ‘oracle’ I get

C:\rb-play\>ar\_connect\_ss.rb  
env.c:257:in oci8lib.so: ORA-12154: TNS:could not resolve the connect  
identifier  
specified (OCIError)  
from c:/ruby/lib/ruby/site\_ruby/1.8/oci8.rb:228:in  
`initialize' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_recor d/connection_adapters/oracle_adapter.rb:585:in `new’  
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/  
active\_recor  
d/connection\_adapters/oracle\_adapter.rb:585:in `new\_connection’

I’ve done a bunch of google searches on this. I read if I am using  
instant client I don’t need a tnsnames.ora file, which I’m not that  
familiar with that file anyway.

Any ideas on this let me know, it has not been as easy as I’ve hoped  
for this.

###################################

require ‘active\_record’

ActiveRecord::Base.establish\_connection(  
:adapter =\> ‘oci’,  
:database =\> ‘mydb’,  
:host =\> ‘[pennies.dev.mycompany.com:1521/ENG](http://pennies.dev.mycompany.com:1521/ENG)’,  
:username =\> ‘me’,  
:password =\> ‘mypassword’  
)

class Template \< ActiveRecord::Base  
set\_table\_name ‘template’  
end

rec = Template.find(:first)

puts rec.TITLE
