OCIError on 'require'; permissions issue?

懵懂的女人 提交于 2019-12-11 17:42:58

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/3101680/ocierror-on-require-permissions-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!