[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Postgresql could not connect to

ngoc

3/6/2006 2:35:00 PM

Hi

My environment is Windows XP and have installed 'gem install postgres-pr'.

Postgresql is running.

I have this code for test of connection

require 'dbi'
dbh = DBI.connect('DBI:Pg:my_db:localhost', 'my_account_name', 'my_passwd')
rows = dbh.execute('select * from customer')
row = rows.fetch
puts row[0]

The error message is

C:\>ruby db.rb
c:/program files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:499:in
`load_driver': is not a class/module (TypeError)
from c:/program
files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:401:in `_ge
t_full_driver'
from c:/program
files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:381:in `connect'
from db.rb:2
Thanks
ngoc
1 Answer

Pistos Christou

3/7/2006 6:17:00 PM

0

ngoc wrote:
> C:\>ruby db.rb
> c:/program files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:499:in
> `load_driver': is not a class/module (TypeError)
> from c:/program
> files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:401:in `_ge
> t_full_driver'
> from c:/program
> files/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:381:in `connect'
> from db.rb:2

See these bug tracker items:

http://rubyforge.org/tracker/index.php?func=detail&aid=2344&group_id=234&am...
http://rubyforge.org/tracker/index.php?func=detail&aid=3675&group_id=234&am...

You may have compiled DBI without Postgres support; or the driver is
missing; or... something else is missing. :)

I encountered this problem recently on FreeBSD. I never solved it.

HTH;
Pistos

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