From: "Vera, Michael" Date: 2002-09-13T21:11:55+09:00 Subject: RE: dbi problem I just installed the mysql module last night, but haven't gone so far as to try it with eruby (yet :) I don't know what web server or OS you are using, but let's assume Apache on Linux. Let's also assume you have the mysql database binary installation on /usr/local/mysql, with all pertinent lib, bin, include, etc directories under that. You may want to add the mysql library to Apache's environment settings (assuming again that you dynamically load mod_env): LoadModule env_module modules/mod_env.so AddModule mod_env.c SetEnv LD_LIBRARY_PATH=/usr/local/mysql/lib ... and of course reload apache. Again, I haven't set up mysql for use with Apache/eruby yet, but this stands out as a likely suspect. DBI module problems are 90% environment settings related problems. Also, don't forget that the install for the mysql module needs the various paths explicitly set; if mysql is not in /usr/local/lib, /usr/local/include, /usr/local/bin. My binary install for glibc6 put everything in ./mysql-version-blah.blah. If you are building from source everything *may* be in the right place. Also, also don't forget to have LD_LIBRARY_PATH set in your profile (edit /etc/profile if you can) when you make the module. export LD_LIBRARY_PATH=blah:blah:/usr/local/mysql/lib and 'source' the profile with . /etc/profile to load it into your current ENV goodLuck.new("Yer gonna need it :P") Michael Vera -----Original Message----- From: J. Fabris [mailto:jayaywhy.fabris@rogerz.com] Sent: Thursday, September 12, 2002 9:02 PM To: ruby-talk@ruby-lang.org Subject: dbi problem Hi. 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 If I run this script (from the syngress Ruby Developer's guide book) DBI.available_drivers.each do |driver| puts "Driver: " + driver DBI.data_sources(driver).each do |dsn| puts " Datasource: " + dsn end end I get this output: Driver: dbi:Mysql: /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:377:in `data_sources' from db_list.rb:7 from db_list.rb:5:in `each' from db_list.rb:5 So, I am confused...these scripts works on my WIN machine at work...am I doing something dumb?