From: "J. Fabris" Date: 2002-09-16T10:28:06+09:00 Subject: Re: dbi problem Sean Chittenden thinks he wrote: >> I'm trying to make ruby dbi work. I searched around, but could not >> find an answer to this, so please forgive me if you've heard this >> one before... >> >> I get the following error when trying to run my script (with eruby, >> the script is supposed to be called from an rhtml page): >> >> /usr/lib/ruby/site_ruby/1.6/dbi/dbi.rb:434:in `load_driver': Could not >> load driver (uninitialized constant Mysql at DBI::DBD) >> (DBI::InterfaceError) >> from /usr/lib/ruby/site_ruby/1.6/dbi/dbi.rb:349:in >> `_get_full_driver' >> from /usr/lib/ruby/site_ruby/1.6/dbi/dbi.rb:329:in `connect' >> from ./pgmkr.rb:125:in `db_connect' >> >> The offending line is: >> @dbh = DBI.connect(datasrc, usr, pwd) >> >> This is my ruby version: >> ruby 1.6.6 (2001-12-26) [i586-linux-gnu] >> >> This file exists: >> /usr/lib/ruby/site_ruby/1.6/DBD/Mysql/Mysql.rb > > It looks like you have an incomplete installation of DBI. You need > the mysql bindings, and you also need the DBD interface to wrap it, so > technically you need three components. The various DBD's are often > times installed automagically for you by the DBI installation or by > the port (if you use FreeBSD), however you can't always assume that. > Once you get that fixed, I think you'll be all good to go. -sc > Thanks. I got it working. If you install from the distro's RPMs, Mandrake 8.2 puts mysql files in /usr/include and /usr/lib instead of /usr/local, so to configure the MySQL Ruby module you have to use the '--with-mysql-dir=/usr' argument to extconf.rb. Then, it will work.