X
X
xmolex2011-10-14 15:07:15
MySQL
xmolex, 2011-10-14 15:07:15

mod_perl vs mysql and correctly closing connection

There is mod_perl + apache 2.2 + mysql

To access the database I use a self-written module, that is, in this module I initialize the connection to the database
my $conn = DBI->connect("dbi:mysql:dbname=$dbn;host=$host;port =$port;", "$username_base", "$password_base", {AutoCommit => 1});
I work with her and everything is fine. But here's the problem, because mod_perl is used, then I can’t find out when apache decides to finish working with my module, respectively, and I can’t close the connection normally either. The database is located on a remote server, another person administers it, so very often I began to get an error in connecting due to the excess of connections to it. Has anyone come across this problem and found a solution? Maybe you can catch the moment Apache closes the application, or maybe Apache itself knows how to work with the database and you need to work through it, and not through Perl's DBI?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
bdmalex, 2011-10-14
@bdmalex

Have you tried this module ?

P
perl_demon, 2011-10-17
@perl_demon

Drip towards the database connection pool

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question