Problem with Mysql in win ruby 1.6.8

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

Any help at all would be appreciated. I’m working on a project and
would like to use webrick with mysql on windows.

BTW – I’ve even gone down the path of attempting to compile it myself
with mingw/msys, but I cannot seem to get configure to work.

Thanks!
Greg Brondo
greg@brondo.com


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:



This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit


Any views or personal opinions expressed within this email may not be those of Talis Information Ltd.
The content of this email message and any files that may be attached are confidential, and for the usage of the intended recipient only. If you are not the intended recipient, then please return this message to the sender and delete it. Any use of this e-mail by an unauthorised recipient is prohibited.

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

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

Any help at all would be appreciated. I’m working on a project and
would like to use webrick with mysql on windows.

BTW – I’ve even gone down the path of attempting to compile it myself
with mingw/msys, but I cannot seem to get configure to work.

Thanks!
Greg Brondo
greg@brondo.com


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk



This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp


Any views or personal opinions expressed within this email may not be those of Talis Information Ltd.
The content of this email message and any files that may be attached are confidential, and for the usage of the intended recipient only. If you are not the intended recipient, then please return this message to the sender and delete it. Any use of this e-mail by an unauthorised recipient is prohibited.

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

···

-----Original Message-----

÷ þÔ×, 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

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.

···

-----Original Message-----

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

Ç óڒ, 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

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.

I don’t think this is it. It’s failing even to find the DBI MySQL driver,
before that driver attempts to use mysql-ruby.

If you look in c:\ruby\lib\ruby\site_ruby\1.6\dbi, is there a directory
named DBD and does that directory have a subdirectory named Mysql?
And do those directories have exactly that capitalization? (“DBD” and “Mysql”)?

···

At 10:12 +0900 3/13/03, Sergei Dolmatov wrote:

-----Original Message-----

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

Paul DuBois wrote:

···

At 10:12 +0900 3/13/03, Sergei Dolmatov wrote:

Ç óڒ, 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.

I don’t think this is it. It’s failing even to find the DBI MySQL driver,
before that driver attempts to use mysql-ruby.

If you look in c:\ruby\lib\ruby\site_ruby\1.6\dbi, is there a directory
named DBD and does that directory have a subdirectory named Mysql?
And do those directories have exactly that capitalization? (“DBD” and
“Mysql”)?

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

Ok. I looked in the directory structure. Under 1.6 there is a DBD and
dbi. There Is NOT a Mysql under dbi. Under ‘i586-mswin32’ there is a
mysql.so but that is all.

Thanks!
Greg B.

Greg Brondo wrote:

Ok. I looked in the directory structure. Under 1.6 there is a DBD and
dbi. There Is NOT a Mysql under dbi. Under ‘i586-mswin32’ there is a
mysql.so but that is all.

That should be easy to fix.
Download the Ruby/DBI package from http://ruby-dbi.sf.net/
and unpack it.
Create a directory named Mysql under the DBD directory (see above) and copy
(from the unpacked Ruby/DBI package) the lib/dbd_mysql/Mysql.rb file into it.

Now it should work.

Regards,

Michael

I don’t think this is it. It’s failing even to find the DBI MySQL driver,
before that driver attempts to use mysql-ruby.

If you look in c:\ruby\lib\ruby\site_ruby\1.6\dbi, is there a directory
named DBD and does that directory have a subdirectory named Mysql?
And do those directories have exactly that capitalization? (“DBD”
and “Mysql”)?

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

Ok. I looked in the directory structure. Under 1.6 there is a DBD
and dbi. There Is NOT a Mysql under dbi. Under ‘i586-mswin32’
there is a mysql.so but that is all.

Ah. Then you have mysql-ruby installed, but you don’t have DBI’s MySQL
driver installed. The standard DBI install uses setup.rb, so I assume
you’re using some other kind of installer? You might try downloading
DBI from SourceForge and using the regular installation instructions.
That will allow you to specify which drivers you want installed.

···

Thanks!
Greg B.

Michael Neumann wrote:

Greg Brondo wrote:

Ok. I looked in the directory structure. Under 1.6 there is a DBD and
dbi. There Is NOT a Mysql under dbi. Under ‘i586-mswin32’ there is a
mysql.so but that is all.

That should be easy to fix.
Download the Ruby/DBI package from http://ruby-dbi.sf.net/
and unpack it.
Create a directory named Mysql under the DBD directory (see above) and copy
(from the unpacked Ruby/DBI package) the lib/dbd_mysql/Mysql.rb file into it.

Now it should work.

Regards,

Michael

That worked! Thanks!