views:

35

answers:

2

I've just recently started learning/using Ruby at work. I've got a super-simple test script that just connects to our Oracle 10g database, runs a select, and 'puts' the results to the screen. This is on a Solaris 10 server. If I run the script as the 'apps' user (the system user that runs our automated scripts), the script runs fines. If I run it as myself, it throws an error:

oci8lib.c:98:in oci8lib.so: OCI Library Initialization Error (OCIError)
    from /usr/local/lib/ruby/site_ruby/1.8/oci8.rb:25
    from ./dbTest.rb:3:in `require'
    from ./dbTest.rb:3

My env vars match the 'apps' user's. I'm assuming this is a permissions issue on some file/directory or other but I don't know where to start looking. Line 25 in the oci8.rb file is a "require 'oci8lib_18'" directive. I have read and execute permissions on the oci8lib_18.so file and the dirs leading to it, but I don't know which dirs it needs to access.

Does anyone have any suggestions on what files/dirs I should check the permissions on? Or any other thoughts on what the issue may be?

UPDATE I've been emailing with the guy that supports OCI8 and it turns out that several of the Oracle directories have permissions that prevent my login from accessing needed info. A simple test was to try to run sqlplus, which also failed.

Dave

+2  A: 

A priori I have no idea. Do other ruby apps run using OCI? Normally libraries and the subsidiary libraries are all installed rwx-r-xr-x. You should never see permissions errors on correctly installed libraries. So I'm making a wild guess you are missing something in your environment, probably like an entry in LD_LIBRARY_PATH

ldd opens shared libraries pretty much the same way your run time image does.

see if this works first:

cd /path/to/library   # where oci8lib.so lives.  
ldd oci8lib.so

This should display all of the externally linked libraries, with no errors. If ldd works, check your LD_LIBRARY_PATH to be sure the path you are now in is declared there. If it does not work, you have some kind of installation issue, like missing libraries, or non-standard paths to libraries.

Get back to us here with your results.

jim mcnamara
I've updated my question. Thanks for the tip on 'ldd'; I've never used that before.
DaveKub
A: 

I've been emailing with the guy that supports OCI8 and it turns out that several of the Oracle directories have permissions that prevent my login from accessing needed info. A simple test was to try to run sqlplus, which also failed.

DaveKub