Hi all
I want to use the database operations in ruby script,so I must install the Mysql-Ruby module and the DBI module
The ruby I use is 1.8.2 for win32. I download the mysql-ruby-2.4.2-1-winpkg(the newest version for win32) but the doc of mysql-ruby-2.4.2-1-winpkg said "it support the ruby version 1.6.6 well".
I installed the mysql-ruby-2.4.2-1-winpkg by run 'ruby install.rb' first
and then installed the ruby-dbi-all-0.0.21 by typing the command
' ruby setup.rb config --with=dbi,dbd_mysql
ruby setup.rb setup
ruby setup.rb install'
ruby setup.rb setup
ruby setup.rb install'
but after finish all installation
I run the script "simple.rb"
the simple.rb contains few programs as below
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
but the system print the errors
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 simple.rb:5
please help me
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 simple.rb:5
please help me
Thank you
__________________________________________________
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
