From: "Pablo Q." Date: 2008-05-14T04:41:50+09:00 Subject: Re: Problem with Active Record and Oracle using oracle_enhanced adapter ------=_Part_9206_839434.1210707710991 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I found the problem, It don't support this syntax: :host =3D> '
/' It must be in this way: :host =3D> '
' , :database =3D> '' so, this is the correct way: ActiveRecord::Base.establish_connection( :username =3D> "pabloq", :password =3D> "db345", :host =3D> "127.0.0.1", :database =3D> '') 2008/5/13 Pablo Q. : > Hi, > > I'm having problem connecting activerecord and ruby with oracle_enhanced > adapter. I'm running this script directly in the machine with the DB. Thi= s > is the example that I'm trying to run: > > require 'rubygems' > require 'active_record' > > > ActiveRecord::Base.establish_connection( > :adapter =3D> "oracle_enhanced", > :username =3D> "*******", > :password =3D> "******", > :host =3D> "127.0.0.1/****") > > > > class Testing < ActiveRecord::Base > set_table_name "idm_test_tables" > set_primary_key "deptno" > end > > > temp =3D Testing.new > > I'm receiving this: > > env.c:257:in oci8lib.so: ORA-12560: TNS:protocol adapter error (OCIError) > from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:229:in `initialize' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.1.0= /lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:692:in > `new' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.1.0= /lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:692:in > `new_connection' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.1.0= /lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:728:in > `initialize' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.1.0= /lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:46:in > `new' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.1.0= /lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:46:in > `oracle_enhanced_connection' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/conne= ction_adapters/abstract/connection_specification.rb:291:in > `send' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/conne= ction_adapters/abstract/connection_specification.rb:291:in > `connection=3D' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/conne= ction_adapters/abstract/connection_specification.rb:259:in > `retrieve_connection' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/conne= ction_adapters/abstract/connection_specification.rb:78:in > `connection' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.= rb:1080:in > `columns' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.= rb:2363:in > `attributes_from_column_definition_without_lock' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/locki= ng/optimistic.rb:55:in > `attributes_from_column_definition' > from > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.= rb:1922:in > `initialize' > from test_activerecord_oracle.rb:19:in `new' > from test_activerecord_oracle.rb:19 > > Tool completed with exit code 1 > > > It seems that I'm having problem with the connection but I'm already try > connecting with sqlplus with the same SID and it works. I'm on a windows > machine, with oracle 11g. Does anyone know what I'm doing wrong? > > -- > Pablo A. Quir=F3s --=20 Pablo A. Quir=F3s ------=_Part_9206_839434.1210707710991--