"Stuart Green" <sgreen@sitewarehouse.net> wrote in message
news:<91qihh$1uer$1@news.tht.net>...
> How do you force a postgres connection via a TCPIP socket and not a Unix
> Socket when connecting through the perl DBI?
>
> I found something in the postgres docs in the SSL area with a switch "-h
> localhost" (this is not in the man pages) but that didn't seem to do
> anything.
>
> Thanks
>
>
Hi.
I use something like this:
my $dsn = "dbi:Pg:dbname=mydb;host=localhost;port=5432";
my $dbh = DBI->connect("$dsn", "$username", "$password");
This works whether the host is localhost or not. Make sure that the
postmaster is started with the -i option.
The full syntax of the DBI connect is:
$dbh =
DBI->connect("dbi:Pg:dbname=$dbname;host=$host;port=$port;options=$options;t
ty=$tty", "$username", "$password");
Try 'perldoc DBD::Pg' for details.
Cheers,
Randy Johnson