connect database

i want to connect to databases by a perl program.

my code:
use DBI;
$dbh=DBI->connect('dbi:Pg:hketutor','john','1357642',{RaiseError=>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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The general format of the connect command is ...

$dbh = DBI->connect($data_source, $username, $password);

Examples of $data_source values:


hope that helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mwhuenAuthor Commented:
I know this general format,
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
my login name is mwhuen
and my password is 1234567

is $data_source =!5432
(if the port=5432)

or, how is right?
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??

mwhuenAuthor Commented:
I know the IP of,
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.