The simple.rb is below and when I run it the error appears
require "dbi"
begin
# connect to the MySQL server
dbh = DBI.connect("dbi:Mysql:test:localhost", "testuser", "testpass")
# 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}"
ensure
# disconnect from server
dbh.disconnect if dbh
end
begin
# connect to the MySQL server
dbh = DBI.connect("dbi:Mysql:test:localhost", "testuser", "testpass")
# 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}"
ensure
# disconnect from server
dbh.disconnect if dbh
end
Error:
c:/program files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:502:in `load_driver': Co
uld not load driver (uninitialized constant MysqlError) (DBI::InterfaceError)
from c:/program files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:392:in `_ge
t_full_driver'
from c:/program files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:372:in `con
nect'
from database.rb:5
uld not load driver (uninitialized constant MysqlError) (DBI::InterfaceError)
from c:/program files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:392:in `_ge
t_full_driver'
from c:/program files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:372:in `con
nect'
from database.rb:5
but I had installed the DBI I don't know why it happens
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
