vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to connect to porgresql database running in a host1 on 5499 port. I am trying to connect from host2, I am getting following error when I try to connect to that database.
DBI connect('dbname=dbname;host=hostname;port=5499','username',...) failed: Couldn't connect to hostname:xxxx/tcp: Operation now in progress at /soft/perl/5.18.1/lib/site_perl/5.18.1/DBD/PgPP.pm line 112.
sub connect_db(){ my $datasource = "dbi:PgPP:dbname=dbname;port=5499;host=hostname"; + my $aut = ''; my $role = 'username' my $attr = {'PrintError' =>1, 'RaiseError' =>1, 'AutoCommit' => 1 + }; my $dbh = DBI->connect($datasource,$role,$aut,$attr) or die $DBI:: +errstr; sleep(1); $dbh->disconnect(); }
I am able to connect to database via 'psql' command from host2.
I also check pg_hba.conf file, it has the entry for host2.
Update:I am running this script on solaris 11
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Connecting to postgres using PgPP
by erix (Prior) on Dec 01, 2017 at 15:13 UTC | |
by vinoth.ree (Monsignor) on Dec 01, 2017 at 18:10 UTC |