TypeError in using MySQL driver

Discussion in 'Ruby' started by Ed Bayudan, May 20, 2009.

  1. Ed Bayudan

    Ed Bayudan Guest

    I get a 'TypeError' when I run the following script:

    require 'dbi'
    dbi = DBI.connect('DBI:Mysql:wrdb_development', 'root', '') do |dbh|
    end

    C:/Rails/InstantRails/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:501:in
    `load_driver': is not a class/module (TypeError)

    This after installing the following gems:
    mysql-2.7.3-mswin32
    dbd-mysql-0.4.2
    dbi-0.4.1
    deprecated-2.0.1

    I am running InstantRails in WinXP

    I've searched all over and the solutions I've found have not fixed this
    problem.
    I did notice that installing the above gems did not create MySQL driver
    directories in
    C:/Rails/InstantRails/ruby/lib/ruby/site_ruby/1.8/DBD/

    I only see 'ODBC' and 'Proxy' directories.

    Are there additional setup scripts I need to run?
    --
    Posted via http://www.ruby-forum.com/.
    Ed Bayudan, May 20, 2009
    #1
    1. Advertising

  2. Ed Bayudan

    Ed Bayudan Guest

    This did the trick for me:
    1. Downloaded dbi-04.1.zip then expanded it in a temp directory

    2. Ran the following scripts in the temp directory:
    2.a ruby setup.rb config
    2.b ruby setup.rb setup
    2.c ruby setup.rb install

    These steps created additional files in the
    \ruby\lib\ruby\site_ruby\1.8\dbi directory which were not generated when
    I first installed the dbi-0.4.1 gem

    These commands now work:

    require 'dbi'
    dbi = DBI.connect('DBI:Mysql:wrdb_development', 'root', '') do |dbh|
    sth = dbh.prepare('select * from testtable')
    sth.execute

    # Print out each row
    while row=sth.fetch do
    p row
    end
    end

    Hopefully with this out of the way, I'd be able to run stored procedures
    as well.

    Ed Bayudan wrote:
    > I get a 'TypeError' when I run the following script:
    >
    > require 'dbi'
    > dbi = DBI.connect('DBI:Mysql:wrdb_development', 'root', '') do |dbh|
    > end
    >
    > C:/Rails/InstantRails/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:501:in
    > `load_driver': is not a class/module (TypeError)
    >
    > This after installing the following gems:
    > mysql-2.7.3-mswin32
    > dbd-mysql-0.4.2
    > dbi-0.4.1
    > deprecated-2.0.1
    >
    > I am running InstantRails in WinXP
    >
    > I've searched all over and the solutions I've found have not fixed this
    > problem.
    > I did notice that installing the above gems did not create MySQL driver
    > directories in
    > C:/Rails/InstantRails/ruby/lib/ruby/site_ruby/1.8/DBD/
    >
    > I only see 'ODBC' and 'Proxy' directories.
    >
    > Are there additional setup scripts I need to run?


    --
    Posted via http://www.ruby-forum.com/.
    Ed Bayudan, May 20, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Björn Linevondeberg
    Replies:
    3
    Views:
    4,109
    George Ter-Saakov
    Mar 5, 2004
  2. Konrad Piersdorfer

    NetBeans and MySQL-JDBC-Driver

    Konrad Piersdorfer, Sep 1, 2003, in forum: Java
    Replies:
    0
    Views:
    816
    Konrad Piersdorfer
    Sep 1, 2003
  3. gao zhixin
    Replies:
    1
    Views:
    1,140
    David Vallner
    Feb 12, 2006
  4. Venks
    Replies:
    8
    Views:
    170
    Charles Oliver Nutter
    Dec 6, 2007
  5. Love4llamas
    Replies:
    0
    Views:
    791
    Love4llamas
    Oct 13, 2011
Loading...

Share This Page