Can't get dbi to work?

R

Robo

I'm using WindowsXP, I've downloaded ruby-dbi-all-0.0.23.tar.gz, and
typed the following commands:

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

During the install phrase, I get the following error:

entering install phase...
mkdir -p e:/ruby/bin
install sqlsh.rb e:/ruby/bin
install failed
Permission denied - e:/ruby/bin/sqlsh.rb
try "ruby setup.rb --help" for usage

Since that didn't work, I deleted the dbi directories from e:\ruby\bin,
and copied the "dbi" and "dbd_mysql" dir to the folder I'm currently
creating my project in. In that folder I ran this file:

require 'dbi'

dbh = DBI.connect('DBI:Mysql:xxxxx', 'xxxxx', 'xxxxx')

And got this error:

../dbi/dbi.rb:499:in `load_driver': is not a class/module (TypeError)
from ./dbi/dbi.rb:401:in `_get_full_driver'
from ./dbi/dbi.rb:381:in `connect'
from import.rb:3

Can someone please explain this to me, why it isn't work, and how I can
fix it? I can't get any further till I can at least connect to the MySQL
db I created.

Thanks

Robo
 
S

Shashank Date

--- Robo said:
I'm using WindowsXP, I've downloaded
ruby-dbi-all-0.0.23.tar.gz, and
typed the following commands:

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

During the install phrase, I get the following
error:

entering install phase...
mkdir -p e:/ruby/bin
install sqlsh.rb e:/ruby/bin
install failed
Permission denied - e:/ruby/bin/sqlsh.rb
try "ruby setup.rb --help" for usage

Since that didn't work, I deleted the dbi
directories from e:\ruby\bin,
and copied the "dbi" and "dbd_mysql" dir to the
folder I'm currently
creating my project in.
<snip>

I will recommend that you delete the files:

E:\ruby\bin\sqlsh.rb
and
E:\ruby\bin\proxyserver.rb

Then delete
E:\ruby\lib\ruby\site_ruby\1.8\dbi.rb.

Finally get rid of the folders:
E:\ruby\lib\ruby\site_ruby\1.8\DBD
and
E:\ruby\lib\ruby\site_ruby\1.8\DBI

And then do a clean install again.

HTH,

-- shanko



_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush
 
M

Michael Neumann

Robo said:
I'm using WindowsXP, I've downloaded ruby-dbi-all-0.0.23.tar.gz, and
typed the following commands:

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

During the install phrase, I get the following error:

entering install phase...
mkdir -p e:/ruby/bin
install sqlsh.rb e:/ruby/bin
install failed
Permission denied - e:/ruby/bin/sqlsh.rb
try "ruby setup.rb --help" for usage

Since that didn't work, I deleted the dbi directories from e:\ruby\bin,
and copied the "dbi" and "dbd_mysql" dir to the folder I'm currently
creating my project in. In that folder I ran this file:

You have to put the file from directory dbd_mysql into a directory named
DBD/Mysql, i.e. there must be a file DBD/Mysql/Mysql.rb somewhere.
require 'dbi'

dbh = DBI.connect('DBI:Mysql:xxxxx', 'xxxxx', 'xxxxx')

And got this error:

../dbi/dbi.rb:499:in `load_driver': is not a class/module (TypeError)
from ./dbi/dbi.rb:401:in `_get_full_driver'
from ./dbi/dbi.rb:381:in `connect'
from import.rb:3

Can someone please explain this to me, why it isn't work, and how I can
fix it? I can't get any further till I can at least connect to the MySQL
db I created.

It can't find the driver due to a wrong location.

Hope this helps.

Regards,

Michael
 
R

Robo

Michael said:
It can't find the driver due to a wrong location.

Hope this helps.

Regards,

Michael

I got it installed correctly now, but still getting the "load_driver" error.

I think I've missed s step somewhere. Up until now I've been using MySQL
with PHP, and with PHP I just have to install MySQL and then everything
works. I'm guessing I'll need to install the driver or API first to make
this work?

So, what do I need to do to make Ruby work with MySQL? I'm using WinXP,
MySQL4, and Windows version of Ruby 1.8.0.

I've downloaded mysql-ruby-2.4.5.tar.gz, but when I type in:

ruby extconf.rb --with-mysql-dir=e:\mysql, I get:

checking for mysql_query() in mysqlclient.lib... no
checking for main() in m.lib... yes
checking for mysql_query() in mysqlclient.lib... no
checking for main() in z.lib... no
checking for mysql_query() in mysqlclient.lib... no
checking for main() in socket.lib... no
checking for mysql_query() in mysqlclient.lib... no
checking for main() in nsl.lib... no
checking for mysql_query() in mysqlclient.lib... no

Guess I'm still new to using databases in places other than PHP, would
be appreciated if someone could guide me through the process.

Thanks

Robo
 
M

Michael Neumann

Robo said:
I got it installed correctly now, but still getting the "load_driver"
error.

Then it can't load the required ruby-mysql (or mysql-ruby) library.
I think I've missed s step somewhere. Up until now I've been using MySQL
with PHP, and with PHP I just have to install MySQL and then everything
works. I'm guessing I'll need to install the driver or API first to make
this work?

Exactly. You need to either install ruby-mysql or mysql-ruby (see RAA,
Ruby's Application Archive: raa.ruby-lang.org).

Regards,

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top