[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: gems for DBI and MySQL?

Kujawa, Greg

3/30/2005 3:48:00 PM

You can go to http://ruby-dbi.source... to download the package, as
it doesn't come bundled with the Ruby One-Click Installer for Windows.
Installation isn't too bad. Just follow the documentation that comes with
the package...

-----Original Message-----
From: R. Mark Volkmann [mailto:mark@ociweb.com]
Sent: Wednesday, March 30, 2005 10:39 AM
To: ruby-talk@ruby-lang.org
Subject: gems for DBI and MySQL?


My apologies for incorrectly posting this on my first try.
I'm reposting it to it's own thread.

I need to access a MySQL database from Ruby.
I'm running under Windows using the one-click installer.
Is DBI the preferred way to do that?

If so, what do I need to install that doesn't come bundled in the one-click
installer? DBI? Ruby MySQL driver?

Are there gems for those or do I need to install them the old fashioned way?

--
R. Mark Volkmann
Partner, Object Computing, Inc.


26 Answers

R. Mark Volkmann

3/30/2005 7:40:00 PM

0

Quoting "Kujawa, Greg" <Greg.Kujawa@DiamondCellar.com>:

> You can go to http://ruby-dbi.source... to download the package, as
> it doesn't come bundled with the Ruby One-Click Installer for Windows.
> Installation isn't too bad. Just follow the documentation that comes with
> the package...

Downloading DBI is easy enough. However, I think I also need a database driver
(DBD) for MySQL. The page you referenced above says

"MySQL (dbd_mysql)

depend on the "MySQL Ruby Module" by TOMITA Masahiro <tommy@tmtm.org>
<URL:http://www.tmtm.org/... or available from the RAA."

I doesn't appear that it can be downloaded from that URL and I can't find
anything in the RAA that claims to be a DBD from MySQL. Can someone tell me
the name of the thing I should looking for?

Maybe it's just me, but it doesn't seem like setting up Ruby to work with MySQL
is very well documented.

> -----Original Message-----
> From: R. Mark Volkmann [mailto:mark@ociweb.com]
> Sent: Wednesday, March 30, 2005 10:39 AM
> To: ruby-talk@ruby-lang.org
> Subject: gems for DBI and MySQL?
>
>
> My apologies for incorrectly posting this on my first try.
> I'm reposting it to it's own thread.
>
> I need to access a MySQL database from Ruby.
> I'm running under Windows using the one-click installer.
> Is DBI the preferred way to do that?
>
> If so, what do I need to install that doesn't come bundled in the one-click
> installer? DBI? Ruby MySQL driver?
>
> Are there gems for those or do I need to install them the old fashioned way?
>
> --
> R. Mark Volkmann
> Partner, Object Computing, Inc.
>
>


--
R. Mark Volkmann
Partner, Object Computing, Inc.


Michael Neumann

3/31/2005 2:18:00 PM

0

Am Mittwoch 30 März 2005 21:39 schrieb R. Mark Volkmann:
> Quoting "Kujawa, Greg" <Greg.Kujawa@DiamondCellar.com>:
> > You can go to http://ruby-dbi.source... to download the package,
> > as it doesn't come bundled with the Ruby One-Click Installer for Windows.
> > Installation isn't too bad. Just follow the documentation that comes with
> > the package...
>
> Downloading DBI is easy enough. However, I think I also need a database
> driver (DBD) for MySQL. The page you referenced above says
>
> "MySQL (dbd_mysql)
>
> depend on the "MySQL Ruby Module" by TOMITA Masahiro <tommy@tmtm.org>
> <URL:http://www.tmtm.org/... or available from the RAA."
>
> I doesn't appear that it can be downloaded from that URL and I can't find
> anything in the RAA that claims to be a DBD from MySQL. Can someone tell
> me the name of the thing I should looking for?

The DBD for Mysql is included in the DBI package. But each DBD depends on some
external modules, in case of DBD::Mysql, this is the above mentioned MySQL
Ruby Module by TOMITA Masashiro.

Regards,

Michael



R. Mark Volkmann

3/31/2005 3:19:00 PM

0

As posted by Vraj Mohan, the procedure for setting up Ruby access to MySQL under
Windows is quite involved. See http://seagecko.org/thoughts/inde....

Does Rails use DBI to access databases?
Does Rails support MySQL out of the box?
I'm not writing a web app. However, if the answer to both questions above is
"yes" then it would seem that the easiest way to get myself setup to use MySQL
would be to install Rails. True?

Quoting Michael Neumann <mneumann@ntecs.de>:

> Am Mittwoch 30 März 2005 21:39 schrieb R. Mark Volkmann:
> > Quoting "Kujawa, Greg" <Greg.Kujawa@DiamondCellar.com>:
> > > You can go to http://ruby-dbi.source... to download the package,
> > > as it doesn't come bundled with the Ruby One-Click Installer for Windows.
> > > Installation isn't too bad. Just follow the documentation that comes with
> > > the package...
> >
> > Downloading DBI is easy enough. However, I think I also need a database
> > driver (DBD) for MySQL. The page you referenced above says
> >
> > "MySQL (dbd_mysql)
> >
> > depend on the "MySQL Ruby Module" by TOMITA Masahiro <tommy@tmtm.org>
> > <URL:http://www.tmtm.org/... or available from the RAA."
> >
> > I doesn't appear that it can be downloaded from that URL and I can't find
> > anything in the RAA that claims to be a DBD from MySQL. Can someone tell
> > me the name of the thing I should looking for?
>
> The DBD for Mysql is included in the DBI package. But each DBD depends on
> some
> external modules, in case of DBD::Mysql, this is the above mentioned MySQL
> Ruby Module by TOMITA Masashiro.
>
> Regards,
>
> Michael
>
>


--
R. Mark Volkmann
Partner, Object Computing, Inc.


khaines

3/31/2005 3:35:00 PM

0

R. Mark Volkmann wrote:

> Does Rails use DBI to access databases?

No.

> Does Rails support MySQL out of the box?
> I'm not writing a web app. However, if the answer to both questions above
> is "yes" then it would seem that the easiest way to get myself setup to
> use MySQL
> would be to install Rails. True?

No.

It's easy to just do it by hand.

Get mysql-ruby (http://tmtm.org/en/mysql/ruby/R...), which is the C
interface, or ruby-mysql (http://tmtm.org/en/ruby/mysql/READ...),
which is the pure Ruby interface. Follow the easy instructions to build
this.

Download DBI (http://rubyforge.org/project...).

After unpacking ruby-dbi:

ruby setup.rb config --with=dbi,dbd_mysql
ruby setup.rb setup
ruby setup.rb install


You'll be good to go.


Kirk Haines

Michael Neumann

3/31/2005 3:37:00 PM

0

Am Donnerstag 31 März 2005 17:19 schrieb R. Mark Volkmann:
> As posted by Vraj Mohan, the procedure for setting up Ruby access to MySQL
> under Windows is quite involved. See
> http://seagecko.org/thoughts/inde....
>
> Does Rails use DBI to access databases?

No.

> Does Rails support MySQL out of the box?

No.

> I'm not writing a web app. However, if the answer to both questions above
> is "yes" then it would seem that the easiest way to get myself setup to use
> MySQL would be to install Rails. True?

You still need the MySQL module and this is what might be troublesome (because
you have to compile it).

Regards,

Michael



Andreas Schwarz

3/31/2005 10:17:00 PM

0

Michael Neumann wrote:
> Am Donnerstag 31 März 2005 17:19 schrieb R. Mark Volkmann:
>>Does Rails support MySQL out of the box?
>
>
> No.

Yes, it includes ruby-mysql.

Michael Neumann

4/1/2005 9:56:00 AM

0

Am Freitag 01 April 2005 00:19 schrieb Andreas Schwarz:
> Michael Neumann wrote:
> > Am Donnerstag 31 März 2005 17:19 schrieb R. Mark Volkmann:
> >>Does Rails support MySQL out of the box?
> >
> > No.
>
> Yes, it includes ruby-mysql.

Oh great! Sorry for the confusion.

Regards,

Michael



R. Mark Volkmann

4/2/2005 3:22:00 AM

0

Quoting Kirk Haines <khaines@enigo.com>:

> R. Mark Volkmann wrote:
>
> > Does Rails use DBI to access databases?
>
> No.
>
> > Does Rails support MySQL out of the box?
> > I'm not writing a web app. However, if the answer to both questions above
> > is "yes" then it would seem that the easiest way to get myself setup to
> > use MySQL
> > would be to install Rails. True?
>
> No.
>
> It's easy to just do it by hand.
>
> Get mysql-ruby (http://tmtm.org/en/mysql/ruby/R...), which is the C
> interface, or ruby-mysql (http://tmtm.org/en/ruby/mysql/READ...),
> which is the pure Ruby interface. Follow the easy instructions to build
> this.
>
> Download DBI (http://rubyforge.org/project...).
>
> After unpacking ruby-dbi:
>
> ruby setup.rb config --with=dbi,dbd_mysql
> ruby setup.rb setup
> ruby setup.rb install

This last step is a problem when you've installed Ruby using the one-click
installer because it tries to overwrite existing .rb files. I had to delete
the existing ones to get this to work.

> You'll be good to go.

When I run my code that contains

dbh = DBI.connect('dbi:Mysql:music:localhost', 'root', '')

I get

c:/Ruby/Ruby1.8.2-14/lib/ruby/site_ruby/1.8/dbi/dbi.rb:490:in `load_driver': is
not a class/module (TypeError)
from c:/Ruby/Ruby1.8.2-14/lib/ruby/site_ruby/1.8/dbi/dbi.rb:392:in `_get
_full_driver'
from c:/Ruby/Ruby1.8.2-14/lib/ruby/site_ruby/1.8/dbi/dbi.rb:372:in
`connect'

I looked at the code. I think it's complaining about not being able to find a
class called DBI::DriverHandle. That class is defined in dbi.rb.

Any idea what's going on here?

--
R. Mark Volkmann
Partner, Object Computing, Inc.


Michael Neumann

4/2/2005 12:50:00 PM

0

Am Samstag 02 April 2005 05:21 schrieb R. Mark Volkmann:
> Quoting Kirk Haines <khaines@enigo.com>:
> > R. Mark Volkmann wrote:
> > > Does Rails use DBI to access databases?
> >
> > No.
> >
> > > Does Rails support MySQL out of the box?
> > > I'm not writing a web app. However, if the answer to both questions
> > > above is "yes" then it would seem that the easiest way to get myself
> > > setup to use MySQL
> > > would be to install Rails. True?
> >
> > No.
> >
> > It's easy to just do it by hand.
> >
> > Get mysql-ruby (http://tmtm.org/en/mysql/ruby/R...), which is the
> > C interface, or ruby-mysql
> > (http://tmtm.org/en/ruby/mysql/READ...), which is the pure Ruby
> > interface. Follow the easy instructions to build this.
> >
> > Download DBI (http://rubyforge.org/project...).
> >
> > After unpacking ruby-dbi:
> >
> > ruby setup.rb config --with=dbi,dbd_mysql
> > ruby setup.rb setup
> > ruby setup.rb install
>
> This last step is a problem when you've installed Ruby using the one-click
> installer because it tries to overwrite existing .rb files. I had to
> delete the existing ones to get this to work.

Or you simply remove the "dbi" from the --with option:

ruby setup.rb config --with=dbd_mysql

> > You'll be good to go.
>
> When I run my code that contains
>
> dbh = DBI.connect('dbi:Mysql:music:localhost', 'root', '')
>
> I get
>
> c:/Ruby/Ruby1.8.2-14/lib/ruby/site_ruby/1.8/dbi/dbi.rb:490:in
> `load_driver': is not a class/module (TypeError)
> from c:/Ruby/Ruby1.8.2-14/lib/ruby/site_ruby/1.8/dbi/dbi.rb:392:in
> `_get _full_driver'
> from c:/Ruby/Ruby1.8.2-14/lib/ruby/site_ruby/1.8/dbi/dbi.rb:372:in
> `connect'

You don't have the ruby-mysql or mysql-ruby library installed, do you?

> I looked at the code. I think it's complaining about not being able to
> find a class called DBI::DriverHandle. That class is defined in dbi.rb.
>
> Any idea what's going on here?

I think, it loads the DBD, but the first (or one of the first) lines of the
DBD/Mysql/Mysql.rb file fails, as this loads the "mysql" library, which is
probably not installed.

Regards,

Michael


Ward Hardman

7/1/2010 4:15:00 AM

0

On Jun 29, 12:59 am, Ward Hardman is a moron madman
<ward.hardmanin...@gmail.com> wrote:
> On Jun 25, 10:30 pm, "Ward F Hardman Jr is a Pervert and a Kook. Let's
> hear it for Ward F 'Pigfucker' Hardman, who sends waves of nauseous
> gases every time the turd powder he inhales catches up with him."
>
> <ward.hardm...@gmail.com> wrote:
> > WARDY'S COLOSTOMY BAG NEEDS CHANGING. IT HAS
> > NEEDED CHANGING FOR OVER A WEEK. WARDY DOESN'T GIVE A SHIT, HE'S TOO
> > BUSY POLICING USENET, TALKING WITH HIS SOCK PUPPETS AND CENSORING
> > CHIEF ENGINEER JEFF
> > POWELL'S POSTS
>
> Indeed!