Oracle OCI8 connection error

I'm trying to connect to a remote oracle database and I am receiving an OCI Error (see below). Here is what I've done thus far:

- I've added the most recent OCI8 gem for windows. It is in the C:\ruby\lib\ruby\1.8 folder. - I've installed Oracle's instant client and set the TNS_ADMIN variable to the instant client path. - I've added the instant_client path to the windows path environment variable. - I've configured the database like this:   adapter: oci   username: my_db   password: my_db   host: //hostname.company.com:1521/my_sid

- I do have a client tool which can access this database via jdbc and odbc, so I know the database can be accessed. - A test through Ruby versus RadRails reveals the same error.

I've done everything I can think of so any assistance will be appreciated.

When trying to generate a scaffold I receive this error:

C:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:49:in `create': ERROR (OCIError)   from C:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:49   from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'   from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'   from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/kernel/requires.rb:7:in `require_library_or_gem'   from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'   from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/kernel/requires.rb:5:in `require_library_or_gem'   from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/oracle_adapter.rb:29   from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'    ... 10 levels...   from ./script/../config/boot.rb:28   from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'   from ./script/destroy:2   from -e:3

yajiri wrote:

I'm trying to connect to a remote oracle database and I am receiving an OCI Error (see below). Here is what I've done thus far:

- I've added the most recent OCI8 gem for windows. It is in the C:\ruby\lib\ruby\1.8 folder. - I've installed Oracle's instant client and set the TNS_ADMIN variable to the instant client path. - I've added the instant_client path to the windows path environment variable. - I've configured the database like this:   adapter: oci   username: my_db   password: my_db   host: //hostname.company.com:1521/my_sid

- I do have a client tool which can access this database via jdbc and odbc, so I know the database can be accessed. - A test through Ruby versus RadRails reveals the same error.

I've done everything I can think of so any assistance will be appreciated.

When trying to generate a scaffold I receive this error:

C:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:49:in `create': ERROR (OCIError)   from C:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:49   from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'   from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'   from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/kernel/requires.rb:7:in `require_library_or_gem'   from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'   from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/kernel/requires.rb:5:in `require_library_or_gem'   from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/oracle_adapter.rb:29   from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'    ... 10 levels...   from ./script/../config/boot.rb:28   from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'   from ./script/destroy:2   from -e:3

I've found that I had multiple OCI gems, so I eliminated the one I didn't want. I now am able to build a scaffold but cannot access the data.

Yajiri

Do you have any more details on the error message you get when you try to access the data?

Lori

yajiri wrote:

I've found that I had multiple OCI gems, so I eliminated the one I didn't want. I now am able to build a scaffold but cannot access the data.

Try creating a tnsnames.ora file in the TNS_ADMIN directory and referencing the host from that:

My database.yml: development:   adapter: oci   username: username   password: password   host: ARCT01D

My tnsnames.ora: ARCT01D = (DESCRIPTION =   (ADDRESS_LIST =     (ADDRESS = (PROTOCOL = TCP)(HOST = TAYLOR-DEV.domain.com)(PORT = 1521))   )   (CONNECT_DATA =     (SID = ARCT01D)     (SERVER = DEDICATED)   ) )

Dan Manges

Thanks for the posts!

After frustrating myself enough for one day, I reverted backward a version (I think it was 15) of the OCI8 gem and my connectivity is now working. The messages in the error were none existant other than what I provided before, which was a basic OCIError. I'll leave it up to the author now to correct the issue, which may be related to Windows XP Professional. When I reach a production version, I'll try again with the latest version.

Thanks, Yajiri