Ruby DBI

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 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.

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 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:inrequire’
from /Library/Ruby/Site/1.8/dbi.rb:48
from test.rb:5:in `require’
from test.rb:5

What could this mean ?

On Aug 31, 7:54 pm, Daniel P. removed_email_add[email protected] 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

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

Thomas S. wrote:

You might want to try:

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs