Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Help - MySql connect.
len
5/26/2006 2:56:00 AM
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.co...
:
# 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::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
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
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Help - MySql connect.
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password