Forum: Ruby on Rails Ruby and MySQL on windows

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5f954338dc631d03b2b4bcc844900b9d?d=identicon&s=25 Kaushik Ghose (kghose)
on 2005-11-29 21:35
Hi,

I'm trying to build a browser driven application using RoR and MySQL. I
have followed one of the tutorials and I can get a web based database
query running fine (Its hard not to with RubyOnRails!)

Now, I don't want the user to have to got to MySQL to set up tables etc.
I want to do that from the app itself. I was thinking of using the DBI
extension for mysql to talk with the server directly and to that end I
used the simple code simple.rb

require "dbi"

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

But when I run it i get this error

 is not a class/module
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:499:in `load_driver'
Press ENTER to close the window...

(The first letter is a blank)

I'm lost :(

thanks
-kg
5f954338dc631d03b2b4bcc844900b9d?d=identicon&s=25 Kaushik Ghose (kghose)
on 2005-11-29 22:02
Followed steps from
http://stonecode.org:2501/stonecodeproductions/pub...

But Is there a way to package it so that my users don't have to go
through all that?

thanks
-kg


kghose wrote:
> Hi,
>
> I'm trying to build a browser driven application using RoR and MySQL. I
> have followed one of the tutorials and I can get a web based database
> query running fine (Its hard not to with RubyOnRails!)
>
> Now, I don't want the user to have to got to MySQL to set up tables etc.
> I want to do that from the app itself. I was thinking of using the DBI
> extension for mysql to talk with the server directly and to that end I
> used the simple code simple.rb
>
> require "dbi"
>
>    begin
>        # connect to the MySQL server
>        dbh = DBI.connect("dbi:Mysql:research:localhost", "root", "")
>        # 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
>
> But when I run it i get this error
>
>  is not a class/module
> c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:499:in `load_driver'
> Press ENTER to close the window...
>
> (The first letter is a blank)
>
> I'm lost :(
>
> thanks
> -kg
This topic is locked and can not be replied to.