Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

when connecting to a DB, should you always disconnect?

Status
Not open for further replies.

spewn

Programmer
May 7, 2001
1,034

i have the following code:

Code:
my $dbh2 = DBI->connect('dbi:mysql:dbName','','');
my $sthX1 = $dbh2->prepare("select oneA, oneB, oneC from products where prodID = '321'");
$sthX1->execute;
use constant ONEA => 0;
use constant ONEB => 1;
use constant ONEC => 2;

i want to know if it's crucial that for each instance of the above script, should i always end with:

Code:
$sthX1->finish();
$dbh2->disconnect();

i have been running my site on my comp without and it's fine, so i wonder if they are even needed.

any ideas?

- g
 
It's good programming, but not necessary with the default mysql config.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top