From: Sergei Dolmatov Date: 2003-03-13T10:12:41+09:00 Subject: Re: Problem with Mysql in win ruby 1.6.8 � ���, 13.03.2003, � 08:56, Greg Brondo �������: > J.Hawkesworth wrote: > > Greg, > > Show us your code - given that it is failing on line 5 hopefully it is > > something simple. > > All the best, > > Jon > > > > -----Original Message----- > > From: Greg Brondo [mailto:greg@brondo.com] > > Sent: 12 March 2003 17:55 > > To: ruby-talk ML > > Subject: Problem with Mysql in win ruby 1.6.8 > > > > > > I've installed the PP 1.6.8 version of Ruby for windows. It comes with > > DBI and Mysql support. However, when I run a test.rb script I wrote > > (basically the stuff from the Mysql-DBI homepage). I get this error: > > > > c:/ruby/lib/ruby/site_ruby/1.6/dbi/dbi.rb:424:in `load_driver': Could > > not load driver (uninitialized constant Mysql at DBI::DBD) > > (DBI::InterfaceError) > > from c:/ruby/lib/ruby/site_ruby/1.6/dbi/dbi.rb:339:in > > '_get_full_driver' > > from c:/ruby/lib/ruby/site_ruby/1.6/dbi/dbi.rb:319:in `connect' > > from C:\webdev\LLI-FRN\test.rb:5 Looks like you didn't install mysql-ruby. It's ruby interface for MySQL API. > require 'dbi' > > begin > # connect to the MySQL server > dbh = DBI.connect("DBI:Mysql:test", "root", "") > # get server version string and display it > row = dbh.select_one("SELECT VERSION()") > puts "Server version: " + row[0] > dbh.select_all("select * from types") do |row| > puts row[0].to_s + " " + row[1] > end > rescue DBI::DatabaseError => e > puts "An error occurred" > print "Error code: ", e.err, "\n" > print "Error message: ", e.errstr, "\n" > ensure > # disconnect from server > dbh.disconnect if dbh > end > > > 'Child' suggested that maybe I do not have the Mysql DBI stuff > installed. I downloaded the mysql-win package and ran install.rb. It > said everything installed fine but I still receive the error. I can > access the DB through DBI:ODBC but I prefer a more native approach. > I'm using Ruby installer 1.6.8 which according to the docs includes > everything I need (at least I think -- I'm coming from Python so some of > this is a bit trickier to get working on Windows). > > Thanks! > Greg Brondo > >