mwhuen
asked on
connect database
i want to connect to databases by a perl program.
my code:
#!/usr/local/bin/perl
use DBI;
$dbh=DBI->connect('dbi:Pg: hketutor', 'john','13 57642',{Ra iseError=> 1}) or die $DBI::errstr;
where hketutor is my dbname, join is my login name, and 135764 is my password.
when i ran this perl program,
DBI->connect failed: ERROR: PQconnectdb() - Missing '=' after 'hketutor' in conninfo
what is the problem?
and I don't know how to specify port, port=?
pls help.
thanks.
my code:
#!/usr/local/bin/perl
use DBI;
$dbh=DBI->connect('dbi:Pg:
where hketutor is my dbname, join is my login name, and 135764 is my password.
when i ran this perl program,
DBI->connect failed: ERROR: PQconnectdb() - Missing '=' after 'hketutor' in conninfo
what is the problem?
and I don't know how to specify port, port=?
pls help.
thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ok. here are a few suggestions to get the IP.
do you connect to the DB using any other mechanism? probably thru a GUI tool or something??
if you do the config/setup section of that toll has to have the IP.
can you connect to the DB from the command prompt??
do you connect to the DB using any other mechanism? probably thru a GUI tool or something??
if you do the config/setup section of that toll has to have the IP.
can you connect to the DB from the command prompt??
ASKER
I know the IP of dhcp-2212.eee.hku.hk,
but i don't know the port of it.
can you provide me an exact $data_source to me?
dbi:Pg:hketutor~147.8 162.212!5432?
if the ip is 147.8.162.212.
but i don't know the port of it.
can you provide me an exact $data_source to me?
dbi:Pg:hketutor~147.8 162.212!5432?
if the ip is 147.8.162.212.
ASKER
but I have difficulty in the $data_source,
i need to connect to a database server which is provided by others, and i don't know what is the port, port=5432?
how can i get the port number? where?
if my database name is hketutor
the machine which install Pg is dhcp-2212.eee.hku.hk
my login name is mwhuen
and my password is 1234567
then
is $data_source =
dbi:Pg:hketutor~dhcp-2212.
?
(if the port=5432)
or, how is right?