G
Grehom
I installed the 'dbi' gem and tried running this ruby script:
require 'dbi'
db_name = "cookbook"
host_name = "localhost"
user_name = "cb_user"
password = "cb_pass"
dsn = "DBI:mysql:host=#{host_name};database=#{db_name}"
# Connect to a database, old style
dbh = DBI.connect(dsn, user_name, password)
# And finally, disconnect
dbh.disconnect
output was:
C:\rubysrcs\ruby_tut>ruby -w test_handle.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 test_handle.rb:11
unfortunately I am too new to ruby to figure out where to go with
this! I apologise if you read my same question last week under
different heading but I got no useful answers.
require 'dbi'
db_name = "cookbook"
host_name = "localhost"
user_name = "cb_user"
password = "cb_pass"
dsn = "DBI:mysql:host=#{host_name};database=#{db_name}"
# Connect to a database, old style
dbh = DBI.connect(dsn, user_name, password)
# And finally, disconnect
dbh.disconnect
output was:
C:\rubysrcs\ruby_tut>ruby -w test_handle.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 test_handle.rb:11
unfortunately I am too new to ruby to figure out where to go with
this! I apologise if you read my same question last week under
different heading but I got no useful answers.