I am new to this so here it goes. There is a post from Sly which I am trying to reply to.
I have ruby connecting to Postgres on Ubuntu. I am running an application from my Windows desktop.
First you need to download the pgsql ODBC drivers.
I would provide URL but I don't have it avaliable.
You will then need to use windows to set up an ODBC connection to you postgresql server.
Postgresql DBI uses ODBC.
Ruby code that works for me.
#conn = DBI.connect('DBI:ODBC:Postgres','postgres','roamer') #Connect to Postgres benstest database
#rs = conn.select_all('SELECT * FROM bensinfo') # retreive data
#
## Process
#rs.each do |row|
# row.each do |column|
# print(column + " ")
# end
# puts
#end
This works but when I tried this from another computer it fails with can't find datasource. Not sure why but give it a try and see if it will help.
|