Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Connecting to postgres using PgPP

by vinoth.ree (Monsignor)
on Dec 01, 2017 at 13:27 UTC ( #1204657=perlquestion: print w/replies, xml ) Need Help??

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...

Replies are listed 'Best First'.
Re: Connecting to postgres using PgPP
by erix (Parson) on Dec 01, 2017 at 15:13 UTC

      Yes listen_addresses set to * only.


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1204657]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2020-09-19 02:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (114 votes). Check out past polls.

    Notices?