Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Help - MySql connect.

Reply
Thread Tools

Help - MySql connect.

 
 
len
Guest
Posts: n/a
 
      05-26-2006
Hello

Trying to learn Ruby using MySql.

Ruby ver 1.8.2
MySQL ver 5.0
OS WinXP sp2

I have loaded the "Northwind" database into MySQL and have run a few
test queries which work fine. I copied the following code from
http://www.kitebird.com/articles:

# simple.rb - simple MySQL script using Ruby DBI module

require "dbi"

begin
# connect to the MySQL server
dbh = DBI.connect("dbi:Mysql:Northwind:localhost:3306", "root",
"cesare05")
# 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

I get the following error when I try and run:

C:\myruby>ruby testmysqlconnect.rb
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:499:in `load_driver': is not
a class/
module (TypeError)
from c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:401:in
`_get_full_driver'

from c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:381:in `connect'
from testmysqlconnect.rb:7

I don't what the problem is -- can anyone help.

Len Sumnler

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL-python-1.2.2 install with no mysql washakie Python 4 01-15-2008 08:15 PM
MySQL Bindings, Pather Server, existing MySQL - help Brian Ablaza Ruby 1 02-27-2006 08:32 PM
"mysql.h: No such file or directory" when building MySQL-python francescomoi@europe.com Python 2 05-11-2005 03:12 PM
DBD:mysql doesn't read mysql option file /etc/my.cnf file JL Perl 0 01-28-2005 03:19 AM
"Pure Python" MySQL module like Net::MySQL Ravi Python 6 07-21-2003 06:53 PM



Advertisments