# Ruby DBI

**URL:** <https://www.ruby-forum.com/t/ruby-dbi/194200>\
**Category:** Ruby\
**Created:** [September 1, 2010, 1:54am UTC](https://www.ruby-forum.com/t/ruby-dbi/194200 "2010-09-01T01:54:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dannypotta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dannypotta](https://www.ruby-forum.com/u/dannypotta)\
**Post date:** [September 1, 2010, 1:54am UTC](https://www.ruby-forum.com/t/ruby-dbi/194200/1 "2010-09-01T01:54:47Z")

</div>

Hello everyone, this is my first post here.

I’ve always been interested in Ruby and I’m finally starting to get my  
hands dirty.

I’m having trouble getting a script connected to a MySQL database, I’ve  
followed tutorials and downloaded the files from  
[http://rubyforge.org/projects/ruby-dbi](http://rubyforge.org/projects/ruby-dbi) and I ran the three commands to  
config, setup and install the DBI.

But in my main ruby script when I require ‘dbi’ it fails and tells me  
that the file couldn’t be found, now obviously I can understand that my  
script can’t see the file I’m telling me to include, but I can’t see any  
explanation anywhere on which file I’m supposed to include, and some  
tutorials have require ‘mysql’ - so Can anyone tell me what I’m doing  
wrong ?

I’m on a UNIX system.

---

<div class="post-metadata">

**Author:** ![dannypotta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dannypotta](https://www.ruby-forum.com/u/dannypotta)\
**Post date:** [September 1, 2010, 2:14am UTC](https://www.ruby-forum.com/t/ruby-dbi/194200/2 "2010-09-01T02:14:59Z")

</div>

Daniel P. wrote:

> Hello everyone, this is my first post here.
> 
> I’ve always been interested in Ruby and I’m finally starting to get my  
> hands dirty.
> 
> I’m having trouble getting a script connected to a MySQL database, I’ve  
> followed tutorials and downloaded the files from  
> [http://rubyforge.org/projects/ruby-dbi](http://rubyforge.org/projects/ruby-dbi) and I ran the three commands to  
> config, setup and install the DBI.
> 
> But in my main ruby script when I require ‘dbi’ it fails and tells me  
> that the file couldn’t be found, now obviously I can understand that my  
> script can’t see the file I’m telling me to include, but I can’t see any  
> explanation anywhere on which file I’m supposed to include, and some  
> tutorials have require ‘mysql’ - so Can anyone tell me what I’m doing  
> wrong ?
> 
> I’m on a UNIX system.

I have installed the correct module now, and this is the error I am  
getting when requiring the ‘dbi’ module:

/Library/Ruby/Site/1.8/rubygems/custom\_require.rb:31:in  
`gem_original_require': no such file to load -- deprecated (LoadError) from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’  
from /Library/Ruby/Site/1.8/dbi.rb:48  
from test.rb:5:in `require’  
from test.rb:5

What could this mean ?

---

<div class="post-metadata">

**Author:** ![dannypotta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dannypotta](https://www.ruby-forum.com/u/dannypotta)\
**Post date:** [September 1, 2010, 9:48am UTC](https://www.ruby-forum.com/t/ruby-dbi/194200/3 "2010-09-01T09:48:58Z")

</div>

On Aug 31, 7:54 pm, Daniel P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> that the file couldn’t be found, now obviously I can understand that my  
> script can’t see the file I’m telling me to include, but I can’t see any  
> explanation anywhere on which file I’m supposed to include, and some  
> tutorials have require ‘mysql’ - so Can anyone tell me what I’m doing  
> wrong ?

You might want to try:

[http://rdbi.hollensbe.org](http://rdbi.hollensbe.org)

It is being actively developed. I’m not sure ruby-dbi is any more.

---

<div class="post-metadata">

**Author:** ![dannypotta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dannypotta](https://www.ruby-forum.com/u/dannypotta)\
**Post date:** [September 1, 2010, 10:28am UTC](https://www.ruby-forum.com/t/ruby-dbi/194200/4 "2010-09-01T10:28:24Z")

</div>

Thomas S. wrote:

> You might want to try:
> 
> [http://rdbi.hollensbe.org](http://rdbi.hollensbe.org)
> 
> It is being actively developed. I’m not sure ruby-dbi is any more.

Here are some other options to consider:

1. use the ruby mysql API directly, as described in those tutorials  
which had ‘require “mysql”’.

dbi is just a layer which sits on top of this, attempting to give a  
consistent API to different types of database. So your code would end up  
being tied to mysql, but then again, the SQL dialect varies between  
databases too.

1. Use a more ruby-flavoured SQL layer such as Sequel.

2. Use a full-blown Object-Relational Mapping layer such as ActiveRecord  
or DataMapper.
