OCIError: OCI Library Initialization Error and Unable to loa

D

Dheeraj Gambhir

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
 
R

rogerdpack

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,284
Latest member
NicholeDum

Latest Threads

Top