|
From: Thomas G. <to...@ad...> - 2001-12-19 19:23:22
|
On Wed, 19 Dec 2001, alta wrote:
>=20
> Nick ...
>=20
> Even though you installed the db, DBI, and DBD, you might want to=20
> verify that each really works. I say this because I have seen=20
> misleading msgs when the DBD was not working right. They had me on a=20
> wild goose chase for awhile.
>=20
> You can test the PostgreSQL database with psql (as you probably=20
> know), and write a short perl program to try to successfully connect=20
> to the db to test DBI and DBD.
>=20
> Come to think of it, it would be nice to have short test programs=20
> that come along with the installation SW. Or better yet, built-in=20
> tests that check connectivity and db before attempting to service the=20
> customer request...
People routinely experience difficulties setting up DBI/DBD and I'm
not too sure why...(?) It is *relatively* painless, the only non-
standard step being that you must declare env vars before installing
DBD.
One other top ten error is not using the -i flag when you start the
server...this kills tcp/ip.
If you would like, we could contribute to Dieter's project by
writing an FAQ. Combing the archives for the usual pitfalls
would make an excellent start.
In the interim here is a script that tests connectivity.
Although I don't mind posting this occasionally, it might be
nice if was available in an FAQ or the package itself.
#!/usr/bin/perl
use DBI;
$dbh =3D DBI->connect("dbi:Pg:dbname=3Dtemplate1", '', '') || die "$DBI::er=
rstr";
$query =3D "select current_time";
$sth =3D $dbh->prepare($query);
$sth->execute || die "$DBI::errstr";
$time =3D $sth->fetchrow_array;
$sth->finish;
$dbh->disconnect;
print "\nThe time is: $time\n";
__END__
--------------------------------------------------------------------
Saint Vincent Catholic Medical Centers =20
--------------------------------------------------------------------
Thomas Good tomg@ { admin | q8 } .nrnet.org
Programmer/Analyst Phone: 718-818-5528=20
Behavioral Health Services Fax: 718-818-5056 =20
Residential Services Mobile: 917-282-7359 =20
--------------------------------------------------------------------
/* Rekordmeister ist nur der FC Bayern M=FCnchen! */
--------------------------------------------------------------------
|