[ruby-dbi-users] Mysql Driver Load error

Makarand Maslekar makarand.km at gmail.com
Mon Dec 1 01:19:11 EST 2008

Hi Erik,

I have tried your suggestions but that did not worked..so i have tried
following thing
i have put the gem 'dbi'  line and then tried to connect to the mysql and it
worked so i am just wondering do i need to put gem 'dbi' line when i will
using the dbi?

gem 'dbi'
require 'dbi'
#gem 'dbd-mysql'

    # connect to the MySQL server
    dbh = DBI.connect("DBI:Mysql:test:localhost", "xyz","xxxxx")
    # get server version string and display it
    row = dbh.select_one("SELECT VERSION()")
    puts "Server version: " + row[0]
rescue DBI::DatabaseError => e
    puts "An error occurred"
    puts "Error code: #{e.err}"
    puts "Error message: #{e.errstr}"
    # disconnect from server
    dbh.disconnect if dbh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ruby-dbi-users/attachments/20081201/405120c9/attachment.html>

More information about the ruby-dbi-users mailing list