tankergoblin
asked on
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?
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?
What operating system are you running this on?
ASKER
win xp
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.
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.
ASKER
where to set this variable?
ASKER
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?
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?
ASKER
can you show me step by step?
ASKER
both linux and window
ASKER
the actual error message i received is
DBI connect('dbname =$dbname;host=$host;port=$ port','$us ername',.. .)failed:
couldn't connect to /tmp/.s.PGSQL.5444: at C:/Perl/site/lib/DBD/PgPP. pm
DBI connect('dbname =$dbname;host=$host;port=$
couldn't connect to /tmp/.s.PGSQL.5444: at C:/Perl/site/lib/DBD/PgPP.
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.
https://www.experts-exchange.com/questions/20895782/How-to-set-environment-variables.html
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.
https://www.experts-exchange.com/questions/20895782/How-to-set-environment-variables.html
ASKER
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:dbn ame=$dbnam e; host=$host;port=$port" ,"$username", "password",{ RaiseError => 1, AutoCommit => 0});
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:dbn
ASKER
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?
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.
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.
ASKER
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.
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
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
);
All the syntax and usage instructions are here.
http://search.cpan.org/~arc/DBD-PgPP-0.06/lib/DBD/PgPP.pm#MODULE_DOCUMENTATION
http://search.cpan.org/~arc/DBD-PgPP-0.06/lib/DBD/PgPP.pm#MODULE_DOCUMENTATION
ASKER
setting system variable is a must procedure?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.