# Oracle OCI8 connection error

**URL:** <https://www.ruby-forum.com/t/oracle-oci8-connection-error/81373>\
**Category:** Rails\
**Created:** [January 8, 2007, 4:37pm UTC](https://www.ruby-forum.com/t/oracle-oci8-connection-error/81373 "2007-01-08T16:37:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yajiri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/53a042/32.png) [@yajiri](https://www.ruby-forum.com/u/yajiri)\
**Post date:** [January 8, 2007, 4:37pm UTC](https://www.ruby-forum.com/t/oracle-oci8-connection-error/81373/1 "2007-01-08T16:37:04Z")

</div>

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](https://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

---

<div class="post-metadata">

**Author:** ![yajiri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/53a042/32.png) [@yajiri](https://www.ruby-forum.com/u/yajiri)\
**Post date:** [January 8, 2007, 4:55pm UTC](https://www.ruby-forum.com/t/oracle-oci8-connection-error/81373/2 "2007-01-08T16:55:07Z")

</div>

yajiri wrote:

> adapter: oci
> 
> C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/core\_ext/kernel/requires.rb:7: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

---

<div class="post-metadata">

**Author:** ![yajiri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/53a042/32.png) [@yajiri](https://www.ruby-forum.com/u/yajiri)\
**Post date:** [January 8, 2007, 8:03pm UTC](https://www.ruby-forum.com/t/oracle-oci8-connection-error/81373/3 "2007-01-08T20:03:36Z")

</div>

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

Lori

---

<div class="post-metadata">

**Author:** ![yajiri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/53a042/32.png) [@yajiri](https://www.ruby-forum.com/u/yajiri)\
**Post date:** [January 8, 2007, 8:07pm UTC](https://www.ruby-forum.com/t/oracle-oci8-connection-error/81373/4 "2007-01-08T20:07:36Z")

</div>

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](http://TAYLOR-DEV.domain.com))(PORT =  
1521))  
)  
(CONNECT\_DATA =  
(SID = ARCT01D)  
(SERVER = DEDICATED)  
)  
)

Dan M.

---

<div class="post-metadata">

**Author:** ![yajiri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/53a042/32.png) [@yajiri](https://www.ruby-forum.com/u/yajiri)\
**Post date:** [January 19, 2007, 4:29pm UTC](https://www.ruby-forum.com/t/oracle-oci8-connection-error/81373/5 "2007-01-19T16:29:38Z")

</div>

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
