# Load\_driver Error - while connecting to DB2. Pl help

**URL:** <https://www.ruby-forum.com/t/load-driver-error-while-connecting-to-db2-pl-help/56874>\
**Category:** Ruby\
**Created:** [April 5, 2006, 10:13am UTC](https://www.ruby-forum.com/t/load-driver-error-while-connecting-to-db2-pl-help/56874 "2006-04-05T10:13:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a8b319/32.png) [@dinesh](https://www.ruby-forum.com/u/dinesh)\
**Post date:** [April 5, 2006, 10:13am UTC](https://www.ruby-forum.com/t/load-driver-error-while-connecting-to-db2-pl-help/56874/1 "2006-04-05T10:13:19Z")

</div>

Hi,

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)\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  
–with-db2-include  
=C:/Progra~1/IBM/SQLLIB/include  
–with-db2-lib=C:/Progra~1/IBM/SQLLIB/lib

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

6)C:\temp\ruby-db2-0.4.4\ruby-db2-0.4.4\ext\db2\>nmake

Microsoft ® Program Maintenance Utility Version 6.00.8168.0  
Copyright © Microsoft Corp 1988-1998. All rights reserved.

c:\rubyInstall\bin\ruby -e “puts ‘EXPORTS’, ‘Init\_db2cli’” \> db2cli-i38  
6-mswin32.def

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  
-IC:/Progr  
a~1/IBM/SQLLIB/include -c -Tcdb2cli.c  
db2cli.c  
db2cli.c(1087) : warning C4761: integral size mismatch in argument;  
conversion s  
upplied

cl -nologo -LD -Fedb2cli.so 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”  
-libpath:“c:/rubyInstal  
l/lib” -def:db2cli-i386-mswin32.def -implib:db2cli-i386-mswin32.lib  
-pdb:db2cli-  
i386-mswin32.pdb

Creating library db2cli-i386-mswin32.lib and object  
db2cli-i386-mswin32.exp

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 db2cli.so 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  
db2cli.so 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  
this…

Sample.rb

* * *

require ‘dbi’

DBI.connect(‘dbi:DB2:RESERVDB’, ‘db2admin’, ‘db2admin’) do |dbh|  
p dbh.select\_all(‘SELECT \* FROM XMLFLIGHTTB’)  
end

* * *

C:\temp\ruby-db2-0.4.4\ruby-db2-0.4.4\samples\>Sample.rb  
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`_get\_full_  
driver’  
from c:/rubyInstall/lib/ruby/site\_ruby/1.8/dbi/dbi.rb:381:in  
`connect’  
from C:/temp/ruby-db2-0.4.4/ruby-db2-0.4.4/samples/saibaba.rb:3

Thanks  
Dinesh

---

<div class="post-metadata">

**Author:** ![dinesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a8b319/32.png) [@dinesh](https://www.ruby-forum.com/u/dinesh)\
**Post date:** [April 5, 2006, 1:56pm UTC](https://www.ruby-forum.com/t/load-driver-error-while-connecting-to-db2-pl-help/56874/2 "2006-04-05T13:56:49Z")

</div>

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  
C:/rubyInstall/lib/ruby/site\_ruby/1.8/test2.rb:5: undefined method  
`createConnec  
tion’ for #\<DB2::Environment:0x2c8baf0 @handle\_type=1, @handle=1\>  
(NoMethodError  
)

Thank You  
Dinesh
