dbdpg
dbdpg copied to clipboard
How to pass multiple hosts and connection parameter target_session_attrs in connection string.
According to the documentation of libpq it is possible
to specify multiple hosts in the connection string. This syntax is used to connect
to a cluster with master and standby nodes. Parameter target_session_attrs
determines
what node will be chosen by libpg.
It is however not clear how one should specify this in the DBI syntax. This host=host1,host2
doesn't work for sure.
Is this supported?
Works for me: can you show the complete error? Here's a local example:
$ perl -MDBD::Pg -e 'use DBI; my $dbh = DBI->connect("dbi:Pg:host=foo,bar,baz","","",{PrintError=>1})'
DBI connect('host=foo,bar,baz','',...) failed: could not translate host name "foo" to address: No address associated with hostname
could not translate host name "bar" to address: No address associated with hostname
could not translate host name "baz" to address: Name or service not known at -e line 1.
$ perl -MDBD::Pg -e 'use DBI; my $dbh = DBI->connect("dbi:Pg:host=foo,bar,baz,localhost","","",{PrintError=>1})'
$
Closing