Re: jdbc autoCommit

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Nov 20 2006 - 18:15:29 EST

  • Next message: Kevin Menard: "RE: SVN build problems"

    Now I don't recall why PooledConnectionImpl calls setAutoCommit(true)
    (???), but generally this is DataSource implementation dependent.

    In other words it is probably ok not to set it to true, but
    regardless of that the framework shouldn't rely on a specific state
    of a Connection after it is returned back to the pool. Consider for
    instance that PoolManager can close unused connections at any time.

    Andrus

    On Nov 20, 2006, at 6:01 PM, Tore Halset wrote:

    > Hello.
    >
    > I get a jdbc Connection using node.getDataSource().getConnection()
    > and setAutoCommit(false) on this to be able to use PostgreSQL
    > blobs. Is it ok to not set autoCommit back to true before closing
    > the connection and returning it to the pool?
    >
    > My current solution is a custom Blob implementing the Fault (thanks
    > for that tip Andrus!) interface to be able to re-query the Blob
    > when it is lost. This custom Blob also handles writing lots of
    > blobs without filling up the heap space.
    >
    > I am wondering if not setting autoCommit back to true leave the
    > transaction in a dangerous state or if the connection pooling will
    > make sure everything works ok. Is this dependant of the connection
    > pooling framework used? I have tested with DriverDataSourceFactory
    > and max connection = 1 and it does not seem to leak connections.
    >
    > http://issues.apache.org/cayenne/browse/CAY-316
    >
    > - Tore.
    >



    This archive was generated by hypermail 2.0.0 : Mon Nov 20 2006 - 18:15:57 EST