Solved

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

Posted on 2010-11-10
1
309 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

773 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