You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "OD (JIRA)" <ji...@apache.org> on 2011/02/01 13:48:29 UTC

[jira] Created: (DBCP-351) setAutoCommit called too many times

setAutoCommit called too many times
-----------------------------------

                 Key: DBCP-351
                 URL: https://issues.apache.org/jira/browse/DBCP-351
             Project: Commons Dbcp
          Issue Type: Bug
    Affects Versions: 1.4
            Reporter: OD


passivateObject in PoolableConnectionFactory sets autoCommit to true, even if defaultAutoCommit is set to false. This results in two extra db queries for every use of the connection (set false, do work, set true). This creates a significant amount of overhead, even if the connection is never even used.

I propose it be changed to:

if(conn.getAutoCommit() != _defaultAutoCommit)
{
  conn.setAutoCommit(_defaultAutoCommit);
}



-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBCP-351) setAutoCommit called too many times

Posted by "James Howe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBCP-351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13068061#comment-13068061 ] 

James Howe commented on DBCP-351:
---------------------------------

Re. Dain's comment, there's only a transaction open if one has sent BEGIN without then sending COMMIT/ROLLBACK, which should always have been done on return to pool.

Would overall performance not be better if new connections are added to the pool to replace disconnected ones, rather than adding all this extra traffic on every request so that the existing connections can use autoReconnect?

> setAutoCommit called too many times
> -----------------------------------
>
>                 Key: DBCP-351
>                 URL: https://issues.apache.org/jira/browse/DBCP-351
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: OD
>             Fix For: 2.0
>
>
> passivateObject in PoolableConnectionFactory sets autoCommit to true, even if defaultAutoCommit is set to false. This results in two extra db queries for every use of the connection (set false, do work, set true). This creates a significant amount of overhead, even if the connection is never even used.
> I propose it be changed to:
> if(conn.getAutoCommit() != _defaultAutoCommit)
> {
>   conn.setAutoCommit(_defaultAutoCommit);
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (DBCP-351) setAutoCommit called too many times

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBCP-351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz updated DBCP-351:
-----------------------------

    Fix Version/s: 1.4.1
                   1.3.1

> setAutoCommit called too many times
> -----------------------------------
>
>                 Key: DBCP-351
>                 URL: https://issues.apache.org/jira/browse/DBCP-351
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: OD
>             Fix For: 1.3.1, 1.4.1
>
>
> passivateObject in PoolableConnectionFactory sets autoCommit to true, even if defaultAutoCommit is set to false. This results in two extra db queries for every use of the connection (set false, do work, set true). This creates a significant amount of overhead, even if the connection is never even used.
> I propose it be changed to:
> if(conn.getAutoCommit() != _defaultAutoCommit)
> {
>   conn.setAutoCommit(_defaultAutoCommit);
> }

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DBCP-351) setAutoCommit called too many times

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBCP-351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12989249#comment-12989249 ] 

Phil Steitz commented on DBCP-351:
----------------------------------

See DBCP-97 and DBCP-102, especially the comment by Dain in DBCP-97.  We can discuss changing the implementation, but I tend to agree with Dain that it is better for passivate to prevent idle connections from holding open database transactions.  Given the back-and-forth on this, it might be best to make the behavior configurable.  Anyone have any better ideas?

> setAutoCommit called too many times
> -----------------------------------
>
>                 Key: DBCP-351
>                 URL: https://issues.apache.org/jira/browse/DBCP-351
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: OD
>
> passivateObject in PoolableConnectionFactory sets autoCommit to true, even if defaultAutoCommit is set to false. This results in two extra db queries for every use of the connection (set false, do work, set true). This creates a significant amount of overhead, even if the connection is never even used.
> I propose it be changed to:
> if(conn.getAutoCommit() != _defaultAutoCommit)
> {
>   conn.setAutoCommit(_defaultAutoCommit);
> }

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBCP-351) setAutoCommit called too many times

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBCP-351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz updated DBCP-351:
-----------------------------

    Fix Version/s:     (was: 1.4.1)
                       (was: 1.3.1)
                   2.0

Changing fix version to 2.0.  I am still not sure how, if at all, we should address this; but I don't think this can be addressed in a patch release.

> setAutoCommit called too many times
> -----------------------------------
>
>                 Key: DBCP-351
>                 URL: https://issues.apache.org/jira/browse/DBCP-351
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: OD
>             Fix For: 2.0
>
>
> passivateObject in PoolableConnectionFactory sets autoCommit to true, even if defaultAutoCommit is set to false. This results in two extra db queries for every use of the connection (set false, do work, set true). This creates a significant amount of overhead, even if the connection is never even used.
> I propose it be changed to:
> if(conn.getAutoCommit() != _defaultAutoCommit)
> {
>   conn.setAutoCommit(_defaultAutoCommit);
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira