couldnt coonect to /tmp/.s.PGSQL.5432

i want to connect to postresplus database thru' perl
im using DBD::pgpp driver.

i received an error message "couldnt coonect to /tmp/.s.PGSQL.5432"

In readme i notice that i need to change the variable to test my driver but where to change?

how to solve?
Who is Participating?
No just for testing. Also a new version just came out with some changes and a new test system.
You do not have to specify system variables if you do not want to use the PgPP .05 test.

If I were you I would get the newest version.


This question I think has been answered.
Hope you are all set.
What operating system are you running this on?
tankergoblinAuthor Commented:
win xp
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Windows XP Environment Variables How to and Info.

Variables you should enter with the values pointing to a live database.


PG_TEST_HOST is optional. When this is not specified, it connects with UNIX socket of '/tmp/.s.PGSQL.5432'. Since you are on XP I would enter it because you do not have Unix sockets.
tankergoblinAuthor Commented:
where to set this variable?
tankergoblinAuthor Commented:
How about in linux OS , i received the same error
how to do.

for windows
i had follow the instruction that provide by you .
where should i point the path to in my enviroment variable?
tankergoblinAuthor Commented:
can you show me step by step?
tankergoblinAuthor Commented:
both linux and window
tankergoblinAuthor Commented:
the actual error message i received is

DBI connect('dbname =$dbname;host=$host;port=$port','$username',...)failed:
couldn't connect to /tmp/.s.PGSQL.5444: at C:/Perl/site/lib/DBD/
These variables are pretty much connection string values. Basically you need to setup the database name you wish to connect to, the IP address of where that database is located, and the user name and password to authenticate to the database.  

Start with XP
1.Right-click My Computer, and then click Properties.
2.Click the Advanced tab.
3.Click Environment variables.
4.Click one the following options, for either a user or a system variable: SELECT USER since its faster to test and you won't have to restart.
5.Click New to add a new variable name and value.
6.Type into Variable Name -> PG_TEST_DB
7.Type into Variable Value the name of your database i.e. dbTesting -Needs to be actual database on the server.
Repeat steps 1 - 5
6.Type into Variable Name -> PG_TEST_USER
7.Type into Variable Value a User name that is allowed to connect to the above database.
Repeat steps 1 - 5
6.Type into Variable Name -> PG_TEST_PASS
7.Type into Variable Value the above users' password.
Repeat steps 1 - 5
6.Type into Variable Name -> PG_TEST_HOST
7.Type into Variable Value the IP address or host name of your server i.e. localhost or 192.168.0.XXX

These need to be valid for the tests to work. If you still can't connect try to edit the PG_TEST_HOST variable value and type an * at the end of the value. Since your error is in Windows lets get that working first. For Linux you do pretty much the exact same thing but using BASH. Heres a good thread.


tankergoblinAuthor Commented:
Yeah i can connect already but
to change the setting in the system is not reliable for user who dont know much about computer
hence DBD::PgPP driver is use for perl.
Is it possible that i can change this system var in perl
my $conn = DBI->connect("dbi:PgPP:dbname=$dbname; host=$host;port=$port" ,"$username", "password",{ RaiseError => 1, AutoCommit => 0});
tankergoblinAuthor Commented:
also i have view your link on linux setting but it seems like it is for java
do you mind to show me step by step as well?
For Windows XP instead of User Environment Variable -Step 4 Use a system variable that way all users of the system will have them and you will not have to manage them for each individual user.

For Linux go into your command line or bash.
Type ->env ->Press Enter, for a list of variables you already have.
Type -> export PG_TEST_DB=myDB
Press Enter
Repeat for the remaining values.
Type ->env ->Press Enter, check for you values make sure they are correct.

tankergoblinAuthor Commented:
Is it change the system variable is the only way to connect to postgres database server

if they any other way
according to readme it is just use for testing

further more if change system variable is compulsory then
why we still need dbit_> connect() to specify the username and etc.
That is the way I understand it as well. After you can connect through the test pass the same values to your connection string.  If you do not specify these in your code they are set to

parameter  =hard coded default
      dbname =current userid
      host       =localhost
      port       =5432
      path       =/tmp
      debug    =undef

 $dbh = DBI->connect(
      $myUser, $myPass

Open in new window

tankergoblinAuthor Commented:
setting system variable is a must procedure?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.