[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1326
  • Last Modified:

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?
0
tankergoblin
Asked:
tankergoblin
  • 10
  • 7
1 Solution
 
RawdustCommented:
What operating system are you running this on?
0
 
tankergoblinAuthor Commented:
win xp
0
 
RawdustCommented:
Windows XP Environment Variables How to and Info.
http://support.microsoft.com/kb/310519

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

PG_TEST_DB=
PG_TEST_USER=
PG_TEST_PASS=
PG_TEST_HOST=

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.
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
tankergoblinAuthor Commented:
where to set this variable?
0
 
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?
0
 
tankergoblinAuthor Commented:
can you show me step by step?
0
 
tankergoblinAuthor Commented:
both linux and window
0
 
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/PgPP.pm
0
 
RawdustCommented:
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.
http://www.experts-exchange.com/Operating_Systems/Linux/Q_20895782.html


 

0
 
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
example
my $conn = DBI->connect("dbi:PgPP:dbname=$dbname; host=$host;port=$port" ,"$username", "password",{ RaiseError => 1, AutoCommit => 0});
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?
0
 
RawdustCommented:
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.


0
 
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.
0
 
RawdustCommented:
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(
      "dbi:PgPP:dbname=$myDatabase;host=$localhost;port=$5432",
      $myUser, $myPass
  );

Open in new window

0
 
RawdustCommented:
0
 
tankergoblinAuthor Commented:
setting system variable is a must procedure?
0
 
RawdustCommented:
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.
http://search.cpan.org/~arc/DBD-PgPP-0.06/

README
http://cpansearch.perl.org/src/ARC/DBD-PgPP-0.06/README

This question I think has been answered.
Hope you are all set.
Rawdust
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 10
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now