Recct Recct - 16 days ago 7
Perl Question

Perl DBI: connect to REMOTE PostgreSQL db still complains about local socket file

I'm trying to use

DBIx::Class
to connect to a remote PostgreSQL db.
My connect string:
"DBI:Pg:database=asterisk:host=example.com:hostaddr=10.10.10.10:port=5432", $user, $pass


example.com
does resolve to '10.10.10.10', swapping both to the IP or having only host=IP all result in

could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? at /usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 1489. at db-access.pl line 26


On this debian I don't have or want postgresql, I do have
libdbd-pg-perl
however. And
DBI->available_drivers
says that I do have
Pg
(It didn't before I installed the library).

How can I find out what it's trying to do and do I need anything else installing? The server in question is configured to allow connections from
10.100.*
addresses which the machine running this code is on and I can connect to it with tools such as PSequel and pgAdmin on my workstation (same network) with the db user in question.

Answer
"DBI:Pg:database=asterisk:host=example.com:hostaddr=10.10.10.10:port=5432"

That should be:

"DBI:Pg:database=asterisk;host=example.com;hostaddr=10.10.10.10;port=5432"

Only the first two separators are colons. The rest of them should be semi-colons.

Comments