Oracle Windows Connect


W

Will Raffaele

Hello all,

I'm a newbie using Windows.

I'm trying to connect to Oracle to get started.

I made it thru a Proxy problem where none of my gems were loading.

Now I'm trying to to connect via Oracle.

I get the following message:

irb(main):001:0> require oci8
NameError: undefined local variable or method `oci8' for main:Object
from (irb):1
from :0

I have put environment variables of ORACLE_HOME, LD_LIBRARY_PATH, and
LD_LIBRARY_PATH32 pointing to C:\oracle\instantclient_11_1.

I've installed:

activerecord-oracle-adapter (1.0.0.9250)
activerecord-oracle_enhanced-adapter (1.2.4)

I did an install of oci8 from gem as in:

gem install ruby-oci8 -v 1.0.4

Previously tried to install from tar.

Any help is greatly appreciated.

Thanks,

Will R.
 
Ad

Advertisements

B

Brian Candler

Will said:
irb(main):001:0> require oci8
NameError: undefined local variable or method `oci8' for main:Object
from (irb):1
from :0

require 'oci8' (you missed the quotes)

otherwise it thinks you're trying to use a local variable or method
called oci8, and it can't find one. Compare:

foo = 'oci8'
require foo
 
W

Will Raffaele

Yes, I tried it both ways:

irb(main):002:0> require 'oci8'
LoadError: no such file to load -- oci8lib_18
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from C:/Ruby/lib/ruby/site_ruby/1.8/oci8.rb:25
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from (irb):2
from :0
irb(main):003:0> foo = 'oci8'
=> "oci8"
irb(main):004:0> require foo
LoadError: no such file to load -- oci8lib_18
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from C:/Ruby/lib/ruby/site_ruby/1.8/oci8.rb:25
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from (irb):4
from :0
irb(main):005:0>
 
K

KUBO Takehiro

What version of ruby-oci8 do you use?
What type of ruby-oci8 package do you use?
Could you list *all* files whose name starts with oci8 under C:\Ruby?

irb(main):002:0> require 'oci8'
LoadError: no such file to load -- oci8lib_18
=A0from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
=A0from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
=A0from C:/Ruby/lib/ruby/site_ruby/1.8/oci8.rb:25

You wrote 'gem install ruby-oci8 -v 1.0.4' but
C:/Ruby/lib/ruby/site_ruby/1.8/oci8.rb is
a part of ruby-oci8 2.0 because it requires oci8lib_18.
I guess that you mix some ruby-oci8 versions and package types.
 
W

Will Raffaele

Could you list *all* files whose name starts with oci8 under C:\Ruby?

C:\Ruby>dir oci8 /s
Directory of C:\Ruby\extract
03/26/2010 04:44 PM <DIR> oci8
Directory of C:\Ruby\extract\oci8\lib
03/26/2010 03:57 PM <DIR> oci8
Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\activerecord-oracle-adapter-1.0.0.92
50\ri
03/29/2010 08:57 AM <DIR> OCI8
Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\activerecord-oracle_enhanced-adapter
-1.2.4\ri
03/26/2010 03:37 PM <DIR> OCI8
Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\ruby-oci8-1.0.4-x86-mswin32\rdoc\cla
sses
03/29/2010 08:56 AM <DIR> OCI8
Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\ruby-oci8-1.0.4-x86-mswin32\rdoc\cla
sses\DBI\DBD
03/29/2010 08:56 AM <DIR> OCI8
Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\ruby-oci8-1.0.4-x86-mswin32\ri
03/29/2010 08:55 AM <DIR> OCI8
Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\ruby-oci8-1.0.4-x86-mswin32\ri\DBI\D
BD
03/29/2010 08:55 AM <DIR> OCI8
Directory of
C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-1.0.4-x86-mswin32\ext
03/29/2010 08:55 AM <DIR> oci8
Directory of C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-2.0.4\ext
03/26/2010 03:43 PM <DIR> oci8
Directory of C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-2.0.4\lib
03/26/2010 03:43 PM <DIR> oci8
Directory of C:\Ruby\lib\ruby\site_ruby\1.8
03/26/2010 04:44 PM <DIR> oci8
C:\Ruby>


In above list, C:\Ruby\extract is where I unloaded my zip files. I did
the

ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

You wrote 'gem install ruby-oci8 -v 1.0.4' but
C:/Ruby/lib/ruby/site_ruby/1.8/oci8.rb is
a part of ruby-oci8 2.0 because it requires oci8lib_18.
I guess that you mix some ruby-oci8 versions and package types.

After the setup metioned above didn't work, I found a website that says
, just
do the gem install ruby-oci8 -v 1.0.4 (see
http://www.oracle.com/technology/pub/articles/haefel-oracle-ruby.html)
 
Ad

Advertisements

B

Brian Candler

Will said:
C:\Ruby>dir oci8 /s

Better would be:

dir oci8*.* /s
That would give me Ruby 2.0, and I could start again to install oci8.

There is no such thing as ruby 2.0.

You can see the contents of instant rails 2.0 here:
http://rubyforge.org/forum/forum.php?forum_id=20229

It has very old versions of everything (dating from Dec 2007). ruby
1.8.6p111 was very stable, but rubygems 1.0.1 is old, and nobody would
run rails 2.0.2 these days.
 
W

Will Raffaele

here is the result of my "dir oci8*.* /s"

(I created and then unzipped into folder C:\Ruby\extract)

C:\Ruby>dir oci8*.* /s
Volume in drive C has no label.
Volume Serial Number is 6C35-317A

Directory of C:\Ruby\extract

03/26/2010 04:44 PM <DIR> oci8
0 File(s) 0 bytes

Directory of C:\Ruby\extract\oci8\lib

03/26/2010 03:57 PM <DIR> oci8
12/31/1969 07:00 PM 2,524 oci8.rb
12/31/1969 07:00 PM 2,561 oci8.rb.in
12/31/1969 07:00 PM 143,445 oci8lib_18.so
12/31/1969 07:00 PM 151,639 oci8lib_191.so
4 File(s) 300,169 bytes

Directory of C:\Ruby\extract\oci8\lib\dbd

12/31/1969 07:00 PM 17,377 OCI8.rb
1 File(s) 17,377 bytes

Directory of C:\Ruby\extract\oci8\lib\oci8

12/31/1969 07:00 PM 17,883 oci8.rb
1 File(s) 17,883 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\activerecord-oracle-adapter-1.0.0.92
50\rdoc\classes

03/29/2010 08:58 AM 7,930 OCI8AutoRecover.html
03/29/2010 08:58 AM <DIR> OCI8AutoRecover.src
1 File(s) 7,930 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\activerecord-oracle-adapter-1.0.0.92
50\ri

03/29/2010 08:57 AM <DIR> OCI8
03/29/2010 08:57 AM <DIR> OCI8AutoRecover
0 File(s) 0 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\activerecord-oracle_enhanced-adapter
-1.2.4\ri

03/26/2010 03:37 PM <DIR> OCI8
0 File(s) 0 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\ruby-oci8-1.0.4-x86-mswin32\rdoc\cla
sses

03/29/2010 08:56 AM <DIR> OCI8
03/29/2010 08:56 AM 19,934 OCI8.html
03/29/2010 08:56 AM <DIR> OCI8.src
1 File(s) 19,934 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\ruby-oci8-1.0.4-x86-mswin32\rdoc\cla
sses\DBI\DBD

03/29/2010 08:56 AM <DIR> OCI8
03/29/2010 08:56 AM 4,089 OCI8.html
03/29/2010 08:56 AM <DIR> OCI8.src
1 File(s) 4,089 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\ruby-oci8-1.0.4-x86-mswin32\rdoc\fil
es\lib

03/29/2010 08:56 AM 2,718 oci8_rb.html
1 File(s) 2,718 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\ruby-oci8-1.0.4-x86-mswin32\rdoc\fil
es\lib\dbd

03/29/2010 08:56 AM 4,235 OCI8_rb.html
1 File(s) 4,235 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\ruby-oci8-1.0.4-x86-mswin32\ri

03/29/2010 08:55 AM <DIR> OCI8
0 File(s) 0 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\doc\ruby-oci8-1.0.4-x86-mswin32\ri\DBI\D
BD

03/29/2010 08:55 AM <DIR> OCI8
0 File(s) 0 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-1.0.4-x86-mswin32\ext

03/29/2010 08:55 AM <DIR> oci8
0 File(s) 0 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-1.0.4-x86-mswin32\ext\oci
8

03/29/2010 08:55 AM 61,515 oci8lib.so
1 File(s) 61,515 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-1.0.4-x86-mswin32\lib

03/29/2010 08:55 AM 44,466 oci8.rb
03/29/2010 08:55 AM 44,503 oci8.rb.in
2 File(s) 88,969 bytes

Directory of
C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-1.0.4-x86-mswin32\lib\dbd


03/29/2010 08:55 AM 16,154 OCI8.rb
1 File(s) 16,154 bytes

Directory of C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-2.0.4\ext

03/26/2010 03:43 PM <DIR> oci8
0 File(s) 0 bytes

Directory of C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-2.0.4\ext\oci8

03/26/2010 03:43 PM 31,447 oci8.c
03/26/2010 03:43 PM 15,606 oci8.h
03/26/2010 03:43 PM 13,858 oci8lib.c
3 File(s) 60,911 bytes

Directory of C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-2.0.4\lib

03/26/2010 03:43 PM <DIR> oci8
03/26/2010 03:43 PM 2,479 oci8.rb.in
1 File(s) 2,479 bytes

Directory of C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-2.0.4\lib\dbd

03/26/2010 03:43 PM 16,786 OCI8.rb
1 File(s) 16,786 bytes

Directory of C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-2.0.4\lib\oci8

03/26/2010 03:43 PM 17,312 oci8.rb
1 File(s) 17,312 bytes

Directory of C:\Ruby\lib\ruby\site_ruby\1.8

03/26/2010 04:44 PM <DIR> oci8
03/26/2010 04:44 PM 2,524 oci8.rb
1 File(s) 2,524 bytes

Directory of C:\Ruby\lib\ruby\site_ruby\1.8\DBD

03/26/2010 04:44 PM 17,377 OCI8.rb
1 File(s) 17,377 bytes

Directory of C:\Ruby\lib\ruby\site_ruby\1.8\oci8

03/26/2010 04:44 PM 17,883 oci8.rb
1 File(s) 17,883 bytes

Total Files Listed:
24 File(s) 676,245 bytes
16 Dir(s) 173,485,522,944 bytes free

C:\Ruby>
 
K

KUBO Takehiro

here is the result of my "dir oci8*.* /s"

To use ruby-oci8 1.0 gems, delete C:\Ruby\lib\ruby\site_ruby\1.8\oci8.rb
and all files under C:\Ruby\lib\ruby\site_ruby\1.8\oci8\.

To use ruby-oci8 2.0, copy *all* files under C:\Ruby\extract\oci8\lib to
C:\Ruby\lib\ruby\site_ruby\1.8 including oci8lib_18.so.
 
Ad

Advertisements

W

Will Raffaele

Took your advice and copied the files as you suggested.
From irb did: require 'oci8'
Still errors, but got past the 1st problem.
New Error:
OCIError: OCI Library Initialization Error
Did a search this error, got to http://www.ruby-forum.com/topic/96884
Copied to Ruby/bin
OCI.dll
oraociicus10.dll
Require 'oci8' returns true
Able to run tutorial which prints result set from Oracle table.

Success!

Thanks and regards to Takehiro and Brian.
 
Ad

Advertisements


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

Top