Forum: Ruby load_driver Error - while connecting to DB2. Pl help..

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Adc6f0b0bc40b0ac4fc3f1ca5000cd38?d=identicon&s=25 Dinesh (Guest)
on 2006-04-05 10:13

I'm trying to connect to DB2 from Ruby, and here are the steps i
followed, but still no luck. Can any one please reply to me!

1)Installed Ruby 1.8.4
2)Installed ruby-db2-0.4.4
3)Installed MS VC 2003
4)Installed DB2

Configurations Done
1)<MS VS Install DIR>\VC98\Bin\VCVARS32.BAT , such that MS environment
variables are loaded to the current command line. also i'm able to
execute the "cl" compiler command. Also have set the DB2DIR to
"C:\Progra~1\IBM\SQLLIB". (DB2 location)

2)cd C:\temp\ruby-db2-0.4.4\ruby-db2-0.4.4

3)ruby setup.rb config

4)cd C:\temp\ruby-db2-0.4.4\ruby-db2-0.4.4\ext\db2

5)C:\temp\ruby-db2-0.4.4\ruby-db2-0.4.4\ext\db2>ruby extconf.rb

checking for SQLConnect() in db2cli.lib... yes
checking for sqlcli.h... yes
creating Makefile


Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

c:\rubyInstall\bin\ruby -e "puts 'EXPORTS', 'Init_db2cli'"  > db2cli-i38

cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/rubyInstall/lib/ruby/1.8/i386-m
swin32 -Ic:/rubyInstall/lib/ruby/1.8/i386-mswin32 -I. -DHAVE_SQLCLI_H
a~1/IBM/SQLLIB/include -c -Tcdb2cli.c
db2cli.c(1087) : warning C4761: integral size mismatch in argument;
conversion s

cl -nologo -LD db2cli.obj msvcrt-ruby18.lib db2cli.lib  old
names.lib user32.lib advapi32.lib wsock32.lib  -link -incremental:no
-debug -opt
:ref -opt:icf -dll -libpath:"C:/Progra~1/IBM/SQLLIB/lib"
l/lib" -def:db2cli-i386-mswin32.def -implib:db2cli-i386-mswin32.lib

Creating library db2cli-i386-mswin32.lib and object

7)C:\temp\ruby-db2-0.4.4\ruby-db2-0.4.4>ruby setup.rb install
setup.rb:714: warning: don't put space before argument parentheses
entering install phase...
mkdir -p c:/rubyInstall/lib/ruby/site_ruby/1.8/db2
install db2cli.rb c:/rubyInstall/lib/ruby/site_ruby/1.8/db2
mkdir -p c:/rubyInstall/lib/ruby/site_ruby/1.8/i386-msvcrt/db2
install c:/rubyInstall/lib/ruby/site_ruby/1.8/i386-msvcrt/db2
install done.

8)When i go to C:\rubyInstall\lib\ruby\site_ruby\1.8\db2, i can see the
file db2cli.rb
Also when i got to
C:\rubyInstall\lib\ruby\site_ruby\1.8\i386-msvcrt\db2, i could see file

So far everything looked OK, but when i try to run the sample program
for the connectivity i'm getting this error!!.. tried all options, but
could not get away. Can any body please give a hand to me to resolve

require 'dbi'

  DBI.connect('dbi:DB2:RESERVDB', 'db2admin', 'db2admin') do |dbh|
    p dbh.select_all('SELECT * FROM XMLFLIGHTTB')
c:/rubyInstall/lib/ruby/site_ruby/1.8/dbi/dbi.rb:499:in `load_driver':
is not a
 class/module (TypeError)
        from c:/rubyInstall/lib/ruby/site_ruby/1.8/dbi/dbi.rb:401:in
        from c:/rubyInstall/lib/ruby/site_ruby/1.8/dbi/dbi.rb:381:in
        from C:/temp/ruby-db2-0.4.4/ruby-db2-0.4.4/samples/saibaba.rb:3

Adc6f0b0bc40b0ac4fc3f1ca5000cd38?d=identicon&s=25 Dinesh (Guest)
on 2006-04-05 13:56
Also, when i try to run the samples directory from the ruby-db2-0.4.4,
it gives me the below error, as undefined method - createConnection? Any
reason???? pl

C:/rubyInstall/lib/ruby/site_ruby/1.8/test2.rb:5: undefined method
tion' for #<DB2::Environment:0x2c8baf0 @handle_type=1, @handle=1>

Thank You
This topic is locked and can not be replied to.