I'm having problem connecting activerecord and ruby with oracle_enhanced
adapter. I'm running this script directly in the machine with the DB. This
is the example that I'm trying to run:
class Testing < ActiveRecord::Base
set_table_name "idm_test_tables"
set_primary_key "deptno"
end
temp = 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/connection_adapters/abstract/connection_specification.rb:291:in
`send'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in
`connection='
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_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/connection_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/locking/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?
I'm having problem connecting activerecord and ruby with oracle_enhanced
adapter. I'm running this script directly in the machine with the DB. This
is the example that I'm trying to run:
class Testing < ActiveRecord::Base
set_table_name "idm_test_tables"
set_primary_key "deptno"
end
temp = 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/connection_adapters/abstract/connection_specification.rb:291:in
`send'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in
`connection='
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_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/connection_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/locking/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?
> 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.
This
> is the example that I'm trying to run:
>
> require 'rubygems'
> require 'active_record'
>
>
> ActiveRecord::Base.establish_connection(
> :adapter => "oracle_enhanced",
> :username => "*******",
> :password => "******",
> :host => "127.0.0.1/****")
>
>
>
> class Testing < ActiveRecord::Base
> set_table_name "idm_test_tables"
> set_primary_key "deptno"
> end
>
>
> temp = 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/connection_adapters/abstract/connection_specification.rb:291:in
> `send'
> from
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in
> `connection='
> from
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_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/connection_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/locking/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ós