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’,
:username => ‘me’,
:password => ‘mypassword’
)
class Template < ActiveRecord::Base
set_table_name ‘template’
end
rec = Template.find(:first)
puts rec.TITLE