I have currently converted my code to use CDBI instead of inline SQL statements. However, I was browsing my test site yesterday and got a weird error. I went and checked the Apache logs and it turned out that there were too many concurent connections to my database.

This of course couldn't be true since I was the only one viewing it. However, I was confused becuase that means that CDBI isn't closing its connection. I was unaware (from my reading of the docs) of a need to do the equilalant of a:

$sth->finish and $dbh->disconnect

with CDBI.

In reality this probably is a result of me using mod_perl. But I still can't figure out how to fix this. I checked the CDBI wiki which had a page on problems using CDBI with mod_perl but I didn't see what I am experiencing discussed.

Anyone have any clues?

Update:

I am not using Apache::DBI. I will look into it. Right now there are no calls to finish. I think 200 database connections is plenty. Raising it would just artically hid the problem. For example, if I just hit refresh on my main pain and type this into my mysql termianl:

show status;
The value of Threads_connected seems to increase unbounded (every time I refresh it increments by 1). This should not happen. It should increase to a certain number and then stop.


In reply to Class::DBI and mod_perl by debiandude

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.