i have a whole collection of scripts that does this... at home. it's been quite a while but i believe what you want is
$dbh->commit; $dbh->disconnect' to close a particular connection. hopefully someone can verify/correct http://search.cpan.org/~timb/DBI-1.620/DBI.pm will document all the details of DBI. On Mon, May 21, 2012 at 10:34 AM, Mark Haney <ma...@abemblem.com> wrote: > I know this will sound incredibly stupid and n00bish, but I've encountered > something I've never dealt with before. I'm setting up a perl based web > application (this is my first web app, not my first perl) and have an issue > with multiple DBI calls in a page and how I handle those calls. For the > most part, I've keep my code over the years to one DBI handle per script, > so this is new to me. > > If I have code like this: > > my $dbh = DBI->connect(config('data_**source'), config('username'), >> config('password')); >> my $dao = EmbMon::DAO->new($dbh); >> my $sql = qq/SELECT abbreviation from factory/; >> my $sth = $dbh->prepare($sql); >> $sth->execute(); >> > > and I want to run another query to the same DB, can I do something like: > > my $sql = qq/Select * from table/; > my $sth = $dbh->prepare($sql); > $sth->execute(); > > Or do I need to call DBI->connect again? I've curious as to how this is > handled, since I don't see a close() or disconnect() used in any of the > existing, inherited, code, which I normally use just to clean up after the > script runs. > > What's the best way to do this? > > -- > > Mark Haney > Software Developer/Consultant > AB Emblem > ma...@abemblem.com > Linux marius.homelinux 3.3.5-2.fc16.x86_64 GNU/Linux > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > > -- since this is a gmail account, please verify the mailing list is included in the reply-to addresses.