Solved

Perl, does the (postgres) database connection automatically closes itself when the perl script ends or exits?

Posted on 2010-11-10
1
310 Views
Last Modified: 2012-05-10
If this is my database connection, does the (postgres) database connection automatically closes itself when the perl script ends or exits?  I guess I just need a yes/no answer, but if you have additional info you can share, go ahead.

my $dbh = DBI->connect("dbi:Pg:dbname=smis;host=$Host", "$User", "$Password", { RaiseError => 1, AutoCommit => 1 });
0
Comment
Question by:rgbcof
1 Comment
 
LVL 16

Accepted Solution

by:
jmatix earned 125 total points
ID: 34104606
If you don't properly close the connection (by $dbh->disconnect), postgres DB will keep the connection alive for a while until it times out. So it is a better practice to close the DB connection as soon as you are done with it.

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hard perl script 16 158
Writing a parser for java language 4 83
Formatting stings with pack and printf in perl 5 78
Perl Frameworks 1 98
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question