Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > How to install Ruby DBI module?

Reply
Thread Tools

How to install Ruby DBI module?

 
 
Justin To
Guest
Posts: n/a
 
      07-01-2008
I downloaded the mysql-ruby-2.8pre4, which I guess is the database
driver, and dbi-0.2.0. I have the folders, but I have no clue where to
go from here... all the websites I look at say type this command:
% ruby extconf.rb
But where do I type this? And do I type it exactly as is?

Thanks!
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Justin To
Guest
Posts: n/a
 
      07-01-2008
Ok, I typed it into the window's command prompt, but i get this error:
\mysql-ruby-2.8pre4\extconf.rb --with-mysql-dir

*** /extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. ...
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Stefano Crocco
Guest
Posts: n/a
 
      07-01-2008
On Tuesday 01 July 2008, Justin To wrote:
> Ok, I typed it into the window's command prompt, but i get this error:
> \mysql-ruby-2.8pre4\extconf.rb --with-mysql-dir
>
> *** /extconf.rb failed ***
> Could not create Makefile due to some reason, probably lack of necessary
> libraries and/or headers. Check the mkmf.log file for more details. ...


Have you looked at the mkmf.log file? What does it say?

Stefano


 
Reply With Quote
 
Justin To
Guest
Posts: n/a
 
      07-01-2008
mkmf.log file:

have_library: checking for main() in libmysql.lib...
-------------------- no

"cl -nologo -Feconftest -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32
-IC:/ruby/lib/ruby/gems/1.8/gems/mysql-ruby-2.8pre4
-Ic:/ruby/lib/ruby/1.8/i386-mswin32 -MD -Zi -O2b2xg- -G6 conftest.c
msvcrt-ruby18-static.lib libmysql.lib oldnames.lib user32.lib
advapi32.lib ws2_32.lib -link -libpath:"." -libpath:"c:/ruby/lib"
-stack:0x2000000"
checked program was:
/* begin */
1: #define WIN32_LEAN_AND_MEAN
2: #include <winsock2.h>
3: #include <windows.h>
4:
5: /*top*/
6: int main() { return 0; }
7: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
/* end */

"cl -nologo -Feconftest -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32
-IC:/ruby/lib/ruby/gems/1.8/gems/mysql-ruby-2.8pre4
-Ic:/ruby/lib/ruby/1.8/i386-mswin32 -MD -Zi -O2b2xg- -G6 conftest.c
msvcrt-ruby18-static.lib libmysql.lib oldnames.lib user32.lib
advapi32.lib ws2_32.lib -link -libpath:"." -libpath:"c:/ruby/lib"
-stack:0x2000000"
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { main(); return 0; }
/* end */

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

 
Reply With Quote
 
Justin To
Guest
Posts: n/a
 
      07-01-2008
Also, when I try to perform the steps for setting up DBI ...

ruby setup.rb config --with=dbi,dbd_mysql
=>entering config phase...
=>config done.

ruby setup.rb setup
=>no such package or diretory 'dbi'
=>try "ruby setup.rb --help" for usage
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Justin To
Guest
Posts: n/a
 
      07-01-2008
Justin To wrote:
> Also, when I try to perform the steps for setting up DBI ...
>
> ruby setup.rb config --with=dbi,dbd_mysql
> =>entering config phase...
> =>config done.


ruby setup.rb config (with no options) works with
ruby setup.rb setup
ruby setup.rb install

but how do i test it now in Ruby? What test code?


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

 
Reply With Quote
 
Justin To
Guest
Posts: n/a
 
      07-01-2008
With this test code:

#!/usr/bin/ruby -w
# simple.rb - simple MySQL script using Ruby DBI module

require "dbi"

begin
# connect to the MySQL server
dbh = DBI.connect("DBI:Mysql:test:localhost", "testuser",
"testpass")
# get server version string and display it
row = dbh.select_one("SELECT VERSION()")
puts "Server version: " + row[0]
rescue DBI:atabaseError => e
puts "An error occurred"
puts "Error code: #{e.err}"
puts "Error message: #{e.errstr}"
ensure
# disconnect from server
dbh.disconnect if dbh
end


I get this error



c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:329:in `load_driver': Unable to
load driver 'Mysql' (DBI::InterfaceError)
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:227:in `_get_full_driver'
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:213:in `connect'
from mysqltest.rb:8
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
ruby install conflict and ruby-dbi-all on debian 3.1 bill Ruby 0 01-06-2006 09:53 AM
DBI Mysql storing DBI:binary, trouble with character 26 Jerome Hauss Ruby 0 10-13-2004 03:04 PM
DBI and DBI::Oracle packages configuration ulloa Perl 1 07-22-2004 05:52 PM
Mason, DBI, and DBI::Pg Asby Perl Misc 0 07-24-2003 09:04 PM



Advertisments