From: Sean Chittenden Date: 2002-07-10T03:54:55+09:00 Subject: Re: How to connect to sql host using dbi > I'm trying to use dbi in place of postgres to connect to my PostgreSQL > and fetch some data. The bone of script that will do this follows > --->cut<--- > #!/usr/bin/env ruby > # $Id$ > require 'dbi' > DBI.connect('DBI:Pg:dbname=testdb;host=sql', nil, nil) do |dbh| > puts "selecting..." > end > --->cut<--- > but I do not know how to say to dbi that the database is not on > localhost but on host sql. Diging arround and on the net I didn't > found any usefull help. You were very close: #!/usr/bin/env ruby # $Id$ require 'dbi' DBI.connect('DBI:Pg:testdb;sql', nil, nil) do |dbh| puts "selecting..." end -sc -- Sean Chittenden