R
Reis
I'm trying to use dbi to connect to MySQL 4.0.18 on windows XP
professional.
I have used a test with this code
------------------------------------------------
# simple.rb - simple MySQL script using Ruby DBI module
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:atabaseError => 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 i have this error.
-----------------------------------------------
`load_driver': Unable to load driver 'Mysql' (DBI::InterfaceError)
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:227:in
`_get_full_driver'
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:213:in `connect'
from test_dbi.rb:6
-----------------------------------------------
When i have installed ruby-dbi i have run this command
-----------------------------------------------
% ruby setup.rb config --with=dbi,dbd_mysql
% ruby setup.rb setup
% ruby setup.rb install
-----------------------------------------------
Could be the problem the version of MySQL?
Thanks so much
--Andrea Reginato.
professional.
I have used a test with this code
------------------------------------------------
# simple.rb - simple MySQL script using Ruby DBI module
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:atabaseError => 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 i have this error.
-----------------------------------------------
`load_driver': Unable to load driver 'Mysql' (DBI::InterfaceError)
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:227:in
`_get_full_driver'
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:213:in `connect'
from test_dbi.rb:6
-----------------------------------------------
When i have installed ruby-dbi i have run this command
-----------------------------------------------
% ruby setup.rb config --with=dbi,dbd_mysql
% ruby setup.rb setup
% ruby setup.rb install
-----------------------------------------------
Could be the problem the version of MySQL?
Thanks so much
--Andrea Reginato.