# Installed mysql gem on windows but it isn't working

**URL:** <https://www.ruby-forum.com/t/installed-mysql-gem-on-windows-but-it-isnt-working/106810>\
**Category:** Ruby\
**Created:** [June 14, 2007, 10:40am UTC](https://www.ruby-forum.com/t/installed-mysql-gem-on-windows-but-it-isnt-working/106810 "2007-06-14T10:40:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![grehom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/47e85d/32.png) [@grehom](https://www.ruby-forum.com/u/grehom)\
**Post date:** [June 14, 2007, 10:40am UTC](https://www.ruby-forum.com/t/installed-mysql-gem-on-windows-but-it-isnt-working/106810/1 "2007-06-14T10:40:49Z")

</div>

I installed the ‘dbi’ gem and tried running this ruby script:

require ‘dbi’

db\_name = “cookbook”  
host\_name = “localhost”  
user\_name = “cb\_user”  
password = “cb\_pass”  
dsn = “DBI:mysql:host=#{host\_name};database=#{db\_name}”

# Connect to a database, old style

dbh = DBI.connect(dsn, user\_name, password)

# And finally, disconnect

dbh.disconnect

output was:  
C:\rubysrcs\ruby\_tut\>ruby -w test\_handle.rb  
C:/Ruby/lib/ruby/site\_ruby/1.8/dbi/dbi.rb:499:in `load_driver': is not a class/module (TypeError) from C:/Ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:401:in`\_get\_full\_driver’  
from C:/Ruby/lib/ruby/site\_ruby/1.8/dbi/dbi.rb:381:in  
`connect’  
from test\_handle.rb:11

unfortunately I am too new to ruby to figure out where to go with  
this! I apologise if you read my same question last week under  
different heading but I got no useful answers.

---

<div class="post-metadata">

**Author:** ![grehom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/47e85d/32.png) [@grehom](https://www.ruby-forum.com/u/grehom)\
**Post date:** [June 15, 2007, 10:06am UTC](https://www.ruby-forum.com/t/installed-mysql-gem-on-windows-but-it-isnt-working/106810/2 "2007-06-15T10:06:55Z")

</div>

On 14 Jun, 08:38, Grehom [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> # Connect to a database, old style
> 
> `_get_full_driver' from C:/Ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:381:in `connect’  
> from test\_handle.rb:11
> 
> unfortunately I am too new to ruby to figure out where to go with  
> this! I apologise if you read my same question last week under  
> different heading but I got no useful answers.

I waded into this code using the -r debug option and it seems that the  
code is failing to find information in the DBD directory. I don’t  
know much about the techy stuff but I have the DBI module working fine  
under perl, and sure enough when I looked in the  
C:\Perl\site\lib\DBD\mysql directory there was a file: GetInfo.pm

Now this led me to unzip the mysql-ruby-windows-2.7.3-r1.zip file and  
sure enough, in a similar layout to the perl directory there is a  
file: C:\TMP\ruby-dbi\lib\dbd\Mysql.rb

However to my untutored eye the contents of this file and the perl  
file aren’t at all similar.

If you’ve bothered to read this far, I can hear you asking why didn’t  
you just install the dbi stuff from above mentioned zip, well I did  
try with no success, despite having the NMAKE program installed and  
trying to set the option --make-prog=nmake

C:\TMP\ruby-dbi\> ruby setup.rb clean  
entering clean phase…  
clean done.

C:\TMP\ruby-dbi\> ruby setup.rb config --make-prog=NMAKE  
entering config phase…  
config done.

C:\TMP\ruby-dbi\> ruby setup.rb setup  
entering setup phase…  
setting #! line to “#!C:/Ruby/bin/ruby”  
setting #! line to “#!C:/Ruby/bin/ruby”  
C:/Ruby/bin/ruby extconf.rb  
checking for sqlite\_open() in sqlite.lib… no  
\*\*\* extconf.rb failed \*\*\*  
Could not create Makefile due to some reason, probably lack of  
necessary libraries and/or headers. Check the mkmf.log file for more  
details. You may need configuration options.

Provided configuration options:  
–with-opt-dir  
–without-opt-dir  
–with-opt-include  
–without-opt-include=${opt-dir}/include  
–with-opt-lib  
–without-opt-lib=${opt-dir}/lib  
–with-make-prog  
–srcdir=.  
–curdir  
–ruby=C:/Ruby/bin/ruby  
–with-sqlite-dir  
–without-sqlite-dir  
–with-sqlite-include  
–without-sqlite-include=${sqlite-dir}/include  
–with-sqlite-lib  
–without-sqlite-lib=${sqlite-dir}/lib  
–with-sqlitelib  
–without-sqlitelib  
NMAKE

Microsoft (R) Program Maintenance Utility Version 1.50  
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

NMAKE : fatal error U1064: MAKEFILE not found and no target specified  
Stop.  
setup failed  
‘system NMAKE’ failed  
try “ruby setup.rb --help” for usage

but this is getting areas which I know nothing about and has me  
stumped. I have had some success in past installing perl modules that  
depended upon the NMake program working.

Please there must be someone out there who has the DBI module working  
under Windows with MySQL, I really want to develop my ruby skills and  
I use MySQL a lot with perl
