Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-11

[dbcp] stmt.getConnection() != Connection used to create the statement

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2
    • 1.3
    • None
    • Operating System: other
      Platform: All

    • 36077

    Description

      Hi,

      I'm not an expert in implementing connection pools or jdbc itself. But shouldn't
      the following code work?

      Connection con = pool.getConnection()
      PreparedStatement ps = con.prepareStatement()

      con.equals(ps.getConnection) // returns false!

      Ok, I don't need it to be equal, but the following also does not work:

      ps.getConnection().close()
      con.isClosed() // is false!!!

      That means, if I have a Statment and want to close its connection, I have to
      remember the conncetion. Is that the requested behavior? Because of this my pool
      is running over.

      The java.sql API says that Statment.getConnection() has to be the connection
      which created the statement.

      Attachments

        1. back-pointers.patch
          21 kB
          Dain Sundstrom

        Activity

          People

            Unassigned Unassigned
            alexander.rupsch@gmx.de Alexander Rupsch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: