« Return to Thread: Using DBI and MySQL gems

Re: Using DBI and MySQL gems

by Erik Hollensbe :: Rate this Message:

Reply to Author | View in Thread

Owein Herrmann wrote:

> Quick question:
>
> I thought using rubygems that to use the dbi and mysql to access a MySQL
> database from Ruby I would only have to do the following:
>
> gem 'mysql'
> gem 'dbi'
>
> and then I could do whatever, eg:
>
> dbh = DBI.connect('DBI:Mysql:money', 'mysqluser', 'pass3')
>
> HOWEVER, what I have to do is:
>
> gem 'mysql'
> gem 'dbi'
> require 'dbi'

Unless rubygems has (recently) changed, the 'gem' command doesn't issue
any requires, it just modifies the load path to point at your gem.

I don't know if this is recommended usage anymore, but provided you
haven't installed dbi with the provided setup.rb, "require 'dbi'" should
work without the gem statements.

-Erik
--
Posted via http://www.ruby-forum.com/.

 « Return to Thread: Using DBI and MySQL gems