Gem info - ruby 1.8.7, pg 0.9.0, postgres 0.8.1 All super old gems. I can't change that.
Code -
require 'rubygems'
require 'active_record'
require 'pg'
require 'postgres'
conn = PGconn.connect(:host => 'db.com', :port => 1234, :username => 'db1', :password => 'db1')
conn = PGconn.open
res = conn.exec("select * from a;")
PGconn.close
Require postgres line causes the following message and does not allow the code to execute. How do I make it work ? The warning is given below:
This is an old, deprecated version of the Ruby PostgreSQL driver that hasn't
been maintained or supported since early 2008.
You should install/require 'pg' instead.
If you need the 'postgres' gem for legacy code that can't be converted, you can
still install it using an explicit version, like so:
gem install postgres -v '0.7.9.2008.01.28'
gem uninstall postgres -v '>0.7.9.2008.01.28'
If you have any questions, the nice folks in the Google group can help:
http://goo.gl/OjOPP / ruby-pg@googlegroups.com