You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Paul J. Lucas" <pj...@barefooters.org> on 2000/07/10 15:05:20 UTC

Re: storing db handles

On Mon, 21 Feb 2000, Brendan W. McAdams wrote:

> I found some info on Apache::DBI in the Mod_Perl developers guide that may
> help.  Basically though I globalised $dbh and then made my connection code
> this:
> 
> $dbh ||= DBI->connect("dbi:mysql:$database","$db_user","$db_pass");

	Unless I'm misreading the Apache::DBI manual page, this is
	completely unnecessary.  Apache::DBI makes persistent
	connections transparent so you can call connect() and
	disconnect() as normal.  You don't need to do one-time
	initializations, global variables, or anything.

	- Paul