Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > OCIError: OCI Library Initialization Error and Unable to loa

Reply
Thread Tools

OCIError: OCI Library Initialization Error and Unable to loa

 
 
Dheeraj Gambhir
Guest
Posts: n/a
 
      07-22-2009
Guys,

I am putting this thing again and again, so you can guess that i need it
badly.So, Please help me if you can.

I am using:
Ruby 1.8.6
Oracle 9i
Windows XP
and i am done with "ruby ruby-oci8-0[1].1.13-mswin.rb"

But when i run this code to check whether i am able to connect to the
Oracle
database server or not:

ruby -r oci8 -e "OCI8.new('mlbread', 'mlbread', 'MLBD').exec('select *
from bam_order.ec_invoice where order-id>2316027') do |r| puts r.join
(' | '); end"

Here mlbread=username, mlbread=password and MLBD=schema name

It gives me the following error:

C:\ruby>ruby -r oci8 -e "OCI8.new('mlbread', 'mlbread', 'MLBD').exec
('select * f
rom bam_order.ec_invoice where order-id>2316027') do |r| puts r.join('
| '); end
"
c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:52:in `init': OCI Library
Initialization
Error (OCIError)
from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:52
************************************************** ****************

For this code:

require 'dbi'
puts DBI.available_drivers
dbh = DBI.connect('DBI:OCI8:MLBD', 'mlbread', 'mlbread')
rs = dbh.prepare('select * from bam_order.ec_invoice where
order_id=139920;')
rs.execute
while rsRow = rs.fetch do
p rsRow
#Alternative output: puts rsRow
#Alternative output: pp rsRow
end
rs.finish
dbh.disconnect

Error is:

C:\Program Files\Watir\examples>ruby oracletest.rb
c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:329:in `load_driver': Unable to
load drive
r 'OCI8' (DBI::InterfaceError)
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:227:in
`_get_full_driver'
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:213:in `connect'
from oracletest.rb:5

************************************************** ****************

For this code:

require 'oci8'
require 'dbi'

connection = OCI8.new( 'mlbread', 'mlbread', 'MLBD')
cursor = connection.exec('select * from bam_order.ec_invoice where
order_id=139920;')
while r = cursor.fetch()
puts r.join(',')
end
cursor.close
connection.logoff

puts "and now using DBI"

puts DBI.available_drivers
db = DBI.connect('DBI:OCI8:MLBD', 'mlbread', 'mlbread')
sql = "select * from bam_order.ec_invoice where order_id=139920;"

dbh.select_all(sql) do | row |
p row
end

Error is:

C:\Program Files\Watir\examples>ruby oracletest1.rb
c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:52:in `init': OCI Library
Initialization
Error (OCIError)
from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:52
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge
m_original_require'
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re
quire'
from oracletest1.rb:1

Please help me and let me know where i am wrong.

Regards
D G
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
rogerdpack
Guest
Posts: n/a
 
      07-23-2009
> ruby -r oci8 -e "OCI8.new('mlbread', 'mlbread', 'MLBD').exec('select *
> from bam_order.ec_invoice where order-id>2316027') do |r| puts r.join
> (' | '); end"
>
> Here mlbread=username, mlbread=password and MLBD=schema name
>
> It gives me the following error:
>
> C:\ruby>ruby -r oci8 -e "OCI8.new('mlbread', 'mlbread', 'MLBD').exec
> ('select * f
> rom bam_order.ec_invoice where order-id>2316027') do |r| puts r.join('
> | '); end
> "
> c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:52:in `init': OCI Library
> Initialization
> Error (OCIError)
> * * * * from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:52


What's on line 52?
=r
 
Reply With Quote
 
 
 
 
Dheeraj Gambhir
Guest
Posts: n/a
 
      07-27-2009
rogerdpack wrote:
>> rom bam_order.ec_invoice where order-id>2316027') do |r| puts r.join('
>> | '); end
>> "
>> c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:52:in `init': OCI Library
>> Initialization
>> Error (OCIError)
>> � � � � from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:52

>
> What's on line 52?
> =r



Line 52 of oci8 goes like "if DBI.const_defined?(:TypeUtil)"


Thanks
D G
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
`init': OCI Library Initialization Error (DBI::DatabaseError Namit Jain Ruby 0 08-20-2009 09:06 AM
OCIError: OCI Library Initialization Error Dheeraj Gambhir Ruby 1 07-22-2009 05:40 AM
Problem after signing in Desktop, Start Menu, and icons do not loa =?Utf-8?B?YWxleGFuZGVyYnJlcw==?= Windows 64bit 4 04-27-2007 11:07 PM
Problems with Oracle OCI library - help please RTJ C++ 2 09-27-2006 04:28 AM
Problems with Oracle OCI library - help please RTJ C Programming 4 12-15-2004 08:30 AM



Advertisments