Loading ...
Sorry, an error occurred while loading the content.

Reusing Connections

Expand Messages
  • holger.schimanski@bayerbbs.com
    If I call storeDocument(...) more than one time on a Transfer object myTransfer, does myTransfer.storeDocument(...) reuse the connection, making a new
    Message 1 of 4 , Dec 1, 2004
    • 0 Attachment
      If I call storeDocument(...) more than one time on a Transfer object myTransfer,
      does myTransfer.storeDocument(...) reuse the connection, making a new connection
      to the database or is he using a connection pool?

      Greetings
      Holger
    • Ronald Bourret
      It reuses the connection. That is, the Transfer object holds the connection open and does not return it to the pool. The reason for this is so it can reuse
      Message 2 of 4 , Dec 2, 2004
      • 0 Attachment
        It reuses the connection. That is, the Transfer object holds the
        connection open and does not return it to the pool.

        The reason for this is so it can reuse prepared statements. If it
        returns the connection to the pool and then gets a new connection from
        the pool later, there is no guarantee that the new connection will have
        the prepared statements it needs.

        (If anybody can explain how prepared statements are supposed to work
        with pooled connections, I'd be happy to listen. What I've just
        described strikes me as wrong, but I can see no way around it. That is,
        I'd like to prepare my statements, leave them in a prepared state, but
        return the connection to the pool while I am not using it.)

        -- Ron

        holger.schimanski@... wrote:
        > If I call storeDocument(...) more than one time on a Transfer object myTransfer,
        > does myTransfer.storeDocument(...) reuse the connection, making a new connection
        > to the database or is he using a connection pool?
      Your message has been successfully submitted and would be delivered to recipients shortly.