http://qs321.pair.com?node_id=1204657

vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

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


All is well. I learn by answering your questions...