Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Disconnecting from a Database

by Indomitus (Scribe)
on Oct 13, 2001 at 21:41 UTC ( [id://118676]=note: print w/replies, xml ) Need Help??


in reply to Disconnecting from a Database

I always put my disconnect statement at the end of the function/program whenever I'm done with the database completely. I'm not a DBI whiz so that might not be The Right Thing but that's always what I've done.
my $dbh = DBI->connect("DBI:mysql:fenonn:localhost","fenonn","password +"); my $sth = $dbh->prepare("SELECT data1 FROM table1"); $sth->execute() || die "Couldn't execute statement: DBI::errstr; stopp +ed"; my ( $data ) = $sth->fetchrow_array(); $dbh->disconnect; print $data;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://118676]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-09-08 10:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.