[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Help needed installing MySQL DBI

Raul Raul

11/11/2007 7:48:00 PM

Peter Vanderhaden wrote:
> I've just downloaded the DBI for MySQL. I have Ruby installed on my
> Ubuntu system, but I don't know how to install the DBI package. (I'm
> new to Linux) Can someone give me a step-by-step list on how to do it,
> including how to unzip the tar.gz file? I'd really appreciate the help.

Peter (welcome to Unix, by the way)

I am not an expert on this, but I had to do it (on a Mac) and I can
help.

Let me tell you that you picked up to start on Linux an installation
that is not the easiest because of 3 layers of interdependency between
components. But if you have a bit of pacience, it should work (all other
installations that you will need to do will be a piece of cake after
this).

First: there are 3 components to be able to work with the Ruby DBI, that
you should install in this order (I assume you have a recent Ruby
version installed):

1) install MySql (5.0 or later); this will generate something called the
"MySql C Client Api" (I mention it as you will find references to it).

2) install the Ruby-MySql module, from
http://www.tmtm.org/en/....
This is a MySql Ruby Client Api (a wrapper around the MySql C client Api
mentioned above). This install will provide the DRIVER (mysql.rb).

[Note: this installation failed this June on my Mac because of a missing
C ulong define, that one has to write manually (!). I don't think the
problem exists on Linux].

3) finally install the Ruby-Dbi module which will use the Driver
installed in previous point. The best doc (all others on the web give
you only part of the story) is
http://www.kitebird.com/articles/ruby-..., written by Paul Du
Bois (MySql guru). He even shows how to untar (the equivalent of what
you called 'unzip') the distribution. The only thing not clearly
described in his document is step 2 above.


Of course, if somebody knows a simpler way, please let us know; in the
meantime, the above works.

Good luck
Raul

--
Posted via http://www.ruby-....

9 Answers

Peter Vanderhaden

11/11/2007 8:05:00 PM

0

Raul,
Thanks the reply. Before I got your reply, I installed the DBI package
so that I could write Ruby scripts that access MySQL databases. When I
attempt to run a test script, I get the
following error:

/usr/local/lib/site_ruby/1.8/dbi.rb:344:in `load_driver': Could not load
driver (no such file to load -- mysql) (DBI::InterfaceError)
from /usr/local/lib/site_ruby/1.8/dbi.rb:227:in
`_get_full_driver'
from /usr/local/lib/site_ruby/1.8/dbi.rb:213:in `connect'
from /root/bin/simple.rb:6

I used the instructions at this link:

www.kitebird.com/articles/rubi-dbi.html

I noticed you mentioned something about one step you mentioned not being
clear in the kitebird article, do you think that might be my problem?
If not, do you have any idea how I'd go about figuring out what the fix
for this error is?
Thanks again,
PV




Raul Parolari wrote:
> Peter Vanderhaden wrote:
>> I've just downloaded the DBI for MySQL. I have Ruby installed on my
>> Ubuntu system, but I don't know how to install the DBI package. (I'm
>> new to Linux) Can someone give me a step-by-step list on how to do it,
>> including how to unzip the tar.gz file? I'd really appreciate the help.
>
> Peter (welcome to Unix, by the way)
>
> I am not an expert on this, but I had to do it (on a Mac) and I can
> help.
>
> Let me tell you that you picked up to start on Linux an installation
> that is not the easiest because of 3 layers of interdependency between
> components. But if you have a bit of pacience, it should work (all other
> installations that you will need to do will be a piece of cake after
> this).
>
> First: there are 3 components to be able to work with the Ruby DBI, that
> you should install in this order (I assume you have a recent Ruby
> version installed):
>
> 1) install MySql (5.0 or later); this will generate something called the
> "MySql C Client Api" (I mention it as you will find references to it).
>
> 2) install the Ruby-MySql module, from
> http://www.tmtm.org/en/....
> This is a MySql Ruby Client Api (a wrapper around the MySql C client Api
> mentioned above). This install will provide the DRIVER (mysql.rb).
>
> [Note: this installation failed this June on my Mac because of a missing
> C ulong define, that one has to write manually (!). I don't think the
> problem exists on Linux].
>
> 3) finally install the Ruby-Dbi module which will use the Driver
> installed in previous point. The best doc (all others on the web give
> you only part of the story) is
> http://www.kitebird.com/articles/ruby-..., written by Paul Du
> Bois (MySql guru). He even shows how to untar (the equivalent of what
> you called 'unzip') the distribution. The only thing not clearly
> described in his document is step 2 above.
>
>
> Of course, if somebody knows a simpler way, please let us know; in the
> meantime, the above works.
>
> Good luck
> Raul

--
Posted via http://www.ruby-....

Raul Raul

11/11/2007 8:28:00 PM

0

Peter Vanderhaden wrote:
> Raul,
> Thanks the reply. Before I got your reply, I installed the DBI package
> so that I could write Ruby scripts that access MySQL databases. When I
> attempt to run a test script, I get the
> following error:
>
> /usr/local/lib/site_ruby/1.8/dbi.rb:344:in `load_driver': Could not load
> driver (no such file to load -- mysql) (DBI::InterfaceError)
> from /usr/local/lib/site_ruby/1.8/dbi.rb:227:in
> `_get_full_driver'
> from /usr/local/lib/site_ruby/1.8/dbi.rb:213:in `connect'
> from /root/bin/simple.rb:6
>
> I used the instructions at this link:
>
> www.kitebird.com/articles/rubi-dbi.html
>
> I noticed you mentioned something about one step you mentioned not being
> clear in the kitebird article, do you think that might be my problem?
> If not, do you have any idea how I'd go about figuring out what the fix
> for this error is?
> Thanks again,
> PV
>

Peter, just follow the 3 steps I listed, in their order: in particular,
step 2 (which installs the DRIVER msyql.rb) is the one which will solve
the problem.

Good luck
Raul
--
Posted via http://www.ruby-....

Peter Vanderhaden

11/11/2007 8:37:00 PM

0

Raul,
I tried this, but I got the following error in step 2:
# ruby extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1

The error is from the require 'mkmf' line in the extconf.rb script. How
can I find out what that is and where to get it?
Thanks again....

Raul Parolari wrote:
> Peter Vanderhaden wrote:
>> Raul,
>> Thanks the reply. Before I got your reply, I installed the DBI package
>> so that I could write Ruby scripts that access MySQL databases. When I
>> attempt to run a test script, I get the
>> following error:
>>
>> /usr/local/lib/site_ruby/1.8/dbi.rb:344:in `load_driver': Could not load
>> driver (no such file to load -- mysql) (DBI::InterfaceError)
>> from /usr/local/lib/site_ruby/1.8/dbi.rb:227:in
>> `_get_full_driver'
>> from /usr/local/lib/site_ruby/1.8/dbi.rb:213:in `connect'
>> from /root/bin/simple.rb:6
>>
>> I used the instructions at this link:
>>
>> www.kitebird.com/articles/rubi-dbi.html
>>
>> I noticed you mentioned something about one step you mentioned not being
>> clear in the kitebird article, do you think that might be my problem?
>> If not, do you have any idea how I'd go about figuring out what the fix
>> for this error is?
>> Thanks again,
>> PV
>>
>
> Peter, just follow the 3 steps I listed, in their order: in particular,
> step 2 (which installs the DRIVER msyql.rb) is the one which will solve
> the problem.
>
> Good luck
> Raul

--
Posted via http://www.ruby-....

Raul Raul

11/11/2007 9:04:00 PM

0

Peter Vanderhaden wrote:
> Raul,
> I tried this, but I got the following error in step 2:
> # ruby extconf.rb
> extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
> from extconf.rb:1
>
> The error is from the require 'mkmf' line in the extconf.rb script. How
> can I find out what that is and where to get it?
> Thanks again....
>


Peter,

I was wondering why you were executing that command, and I now saw
that it is listed in the site.
Now, the best when you install in Unix is to read the README file (or
INSTALL, etc), because they are updated (not the instructions in the
site from where you donwload; of course, glance at them, just in case,
but go with the instructions in the distribution):

In the README file under ruby-dbi, you will see that it says to do:

ruby setup.rb config --with=dbi,dbd_pg, ... # it is an example
ruby setup.rb setup
ruby setup.rb install

In your case, do this:

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

I hope that this helps,
Raul

--
Posted via http://www.ruby-....

Raul Raul

11/11/2007 9:10:00 PM

0

Raul Parolari wrote:
> Peter Vanderhaden wrote:
>> Raul,
>> I tried this, but I got the following error in step 2:
>> # ruby extconf.rb
>> extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
>> from extconf.rb:1
>>
>> The error is from the require 'mkmf' line in the extconf.rb script. How
>> can I find out what that is and where to get it?
>> Thanks again....
>>
>

Peter,

Sorry for that 'sudo' (it is for the Mac). On Linux, just do:

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

--
Posted via http://www.ruby-....

Windham, Kristopher R.

11/11/2007 9:27:00 PM

0

Peter,
what os are you running?

sounds like you need to install the ruby1.8-dev package
should be something simple like

apt-get install ruby1.8-dev


http://rubyforge.org/forum/forum.php?thread_id=4161&for...


On Nov 11, 2007, at 3:36 PM, Peter Vanderhaden wrote:

> Raul,
> I tried this, but I got the following error in step 2:
> # ruby extconf.rb
> extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
> from extconf.rb:1
>
> The error is from the require 'mkmf' line in the extconf.rb
> script. How
> can I find out what that is and where to get it?
> Thanks again....
>
> Raul Parolari wrote:
>> Peter Vanderhaden wrote:
>>> Raul,
>>> Thanks the reply. Before I got your reply, I installed the DBI
>>> package
>>> so that I could write Ruby scripts that access MySQL databases.
>>> When I
>>> attempt to run a test script, I get the
>>> following error:
>>>
>>> /usr/local/lib/site_ruby/1.8/dbi.rb:344:in `load_driver': Could
>>> not load
>>> driver (no such file to load -- mysql) (DBI::InterfaceError)
>>> from /usr/local/lib/site_ruby/1.8/dbi.rb:227:in
>>> `_get_full_driver'
>>> from /usr/local/lib/site_ruby/1.8/dbi.rb:213:in `connect'
>>> from /root/bin/simple.rb:6
>>>
>>> I used the instructions at this link:
>>>
>>> www.kitebird.com/articles/rubi-dbi.html
>>>
>>> I noticed you mentioned something about one step you mentioned
>>> not being
>>> clear in the kitebird article, do you think that might be my
>>> problem?
>>> If not, do you have any idea how I'd go about figuring out what
>>> the fix
>>> for this error is?
>>> Thanks again,
>>> PV
>>>
>>
>> Peter, just follow the 3 steps I listed, in their order: in
>> particular,
>> step 2 (which installs the DRIVER msyql.rb) is the one which will
>> solve
>> the problem.
>>
>> Good luck
>> Raul
>
> --
> Posted via http://www.ruby-....
>


Peter Vanderhaden

11/11/2007 9:31:00 PM

0

I tried your latest suggestion, but I get the same error. I figure that
something probably got mixed up when I attempted the initial
installation. I don't know how to do it, but it might be best to remove
everything related to the Ruby dbi and start over. What do you think?
I appreciate your assistance.


Raul Parolari wrote:
> Raul Parolari wrote:
>> Peter Vanderhaden wrote:
>>> Raul,
>>> I tried this, but I got the following error in step 2:
>>> # ruby extconf.rb
>>> extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
>>> from extconf.rb:1
>>>
>>> The error is from the require 'mkmf' line in the extconf.rb script. How
>>> can I find out what that is and where to get it?
>>> Thanks again....
>>>
>>
>
> Peter,
>
> Sorry for that 'sudo' (it is for the Mac). On Linux, just do:
>
> $ ruby setup.rb config --with=dbi,dbd_mysql
> $ ruby setup.rb setup
> $ ruby setup.rb install

--
Posted via http://www.ruby-....

Peter Vanderhaden

11/11/2007 9:33:00 PM

0

Kristopher,
I'm running Ubuntu 7.04
PV

Windham, Kristopher R. wrote:
> Peter,
> what os are you running?
>
> sounds like you need to install the ruby1.8-dev package
> should be something simple like
>
> apt-get install ruby1.8-dev
>
>
> http://rubyforge.org/forum/forum.php?thread_id=4161&for...

--
Posted via http://www.ruby-....

Windham, Kristopher R.

11/11/2007 9:49:00 PM

0

try typing these two commands

sudo apt-get install build-essential

sudo apt-get install ruby1.8-dev

this should give you the mkmf.rb file in the proper location

then you can use the extconf.rb for installing the ruby-mysql module




On Nov 11, 2007, at 4:32 PM, Peter Vanderhaden wrote:

> Kristopher,
> I'm running Ubuntu 7.04
> PV
>
> Windham, Kristopher R. wrote:
>> Peter,
>> what os are you running?
>>
>> sounds like you need to install the ruby1.8-dev package
>> should be something simple like
>>
>> apt-get install ruby1.8-dev
>>
>>
>> http://rubyforge.org/forum/forum.php?thread_id=4161&for...
>
> --
> Posted via http://www.ruby-....
>