Re: problem connecting client to a postgresSQL server
От | Gurudutt |
---|---|
Тема | Re: problem connecting client to a postgresSQL server |
Дата | |
Msg-id | 12040189525.20011109203735@indvalley.com обсуждение исходный текст |
Ответ на | Re: problem connecting client to a postgresSQL server (GB Clark II <gclarkii@vsservices.com>) |
Ответы |
General question about DBI/DBD
|
Список | pgsql-general |
Hello GB, Install DBI modules for PgSQL and start working HERE IS SAMPLE PROGRAM ---------------------- PROGRAM STARTS HERE ----------------------- #! <your path to perl> use DBI; # DATABASE HANDLE DECLARATION my $dbHandle; # QUERY VARIABLE DECLARATION my $dbQuery; # QUERY VARIABLE HANDLE DECLARATION my $dbQueryHandle; # VARIABLE TO STORE THE HASH REFS my $dbRow; # ESTABLISH CONNECTION TO THE PG-SQL AND CONCERNED DATABASE $dbHandle=DBI->connect( "dbi:Pg:dbname=testdb", "username", "password") || die $DBI::errstr ; # QUERY A SIMPLE TABLE $dbQuery="select testcode,testname from testtab"; # PREPARE THE QUERY $dbQueryHandle=$dbHandle->prepare($dbQuery) || die $dbHandle->errstr; # EXECUTE THE QUERY $dbQueryHandle->execute || die $dbHandle->errstr; # FETCH A ROW if($dbRow=$dbHandle->fetchrow_hashref()) { # PRINT THE FETCHED RESULT SET print "\n TESTCODE: $dbRow->{testcode}"; print "\n TESTNAME: $dbRow->{testname}"; } $dbQueryHandle->finish || die $dbHandle->errstr; $dbHandle->disconnect || die $DBI::errstr; --------------------PROGRAM ENDS---------------------- if you're connecting to some remote machine, just add the IP address in the DBI connect statement. Hope I have helped u a bit -- Best regards, Gurudutt mailto:guru@indvalley.com Life is not fair - get used to it. Bill Gates Friday, November 09, 2001, 3:53:23 PM, you wrote: GCI> On Friday 09 November 2001 03:22, darwin wrote: >> Hi!! Im Darwin a student from DATA COllege San Fernando >> Pampanga, Philppines. I am a new memeber in your mailing >> list. Hope you could accomodate me. >> >> I just want to consult anyone out there who could help me in >> my problem regarding "HOW TO CONNECT A CLIENT TO A >> POSTGRESSQL SERVER USING PERL ?". I am having a hard since >> August and its bugging me cause I could not finish my >> thesis. >> >> I'm hopping that a generous mind could share something about >> it.
В списке pgsql-general по дате отправления: