Commons Dbcp
  1. Commons Dbcp
  2. DBCP-156

[dbcp] Specifying the maximum lifetime of a connection

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 2.0
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      It would be excellent if BasicDataSource had a "maxLifetime" property, for
      specifying the maximum lifetime of a connection in the pool, no matter how long
      it's been active or idle, and no matter whether it still seems to be alive.
      Commons DBCP does not support this yet; it just offers various connection
      validation means, which is not the same.

      This is particularly relevant for MySQL Connector/J 3.0.x which tries to apply
      some weird automatic recovery when a MySQL connection has timed out, resulting
      in all sorts of issues. The best way to deal with this is to set the maximum
      lifetime of a connection to 4 hours or the like: If it's older, simply kill it,
      even if it's still alive at that point of time.

      Note that Proxool (http://proxool.sourceforge.net) does have such a property,
      namely "maximum-connection-lifetime". Resin's connection pool has a similar
      property named "max-pool-time" (http://www.caucho.com/resin-2.1/ref/db-
      config.xtp). I tend to prefer Commons DBCP, but the lack of such a property
      forces me to look for alternative pools.

      Juergen

        Activity

        Juergen Hoeller created issue -
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 28211 12341387
        Henri Yandell made changes -
        Component/s Dbcp [ 12311109 ]
        Project Commons [ 12310458 ] Commons Dbcp [ 12310469 ]
        Affects Version/s 1.1 Final [ 12311652 ]
        Key COM-1235 DBCP-156
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Henri Yandell made changes -
        Affects Version/s 1.1 Final [ 12311719 ]
        Phil Steitz made changes -
        Bugzilla Id 28211
        Fix Version/s 1.3 [ 12311977 ]
        Mark Thomas made changes -
        Fix Version/s 2.0 [ 12313721 ]
        Fix Version/s 1.3 [ 12311977 ]
        Mark Thomas made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Phil Steitz made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Juergen Hoeller
          • Votes:
            4 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development