[dbcp]

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[dbcp]

DmitrI Sherstobitov
Hi.

I have a question about supporting derby database in dbcp2. I’m using JMeter to test derby dB and in case of auroCommit=false there is exception occurs on connection validation step.

Using rollbackOnReturn and setEnableAutoCommitOnReturn booleans actually breaks all logic. ( because in first case we lose all data on rollback in second case we set autoCommit to true always for connection)

I doesn’t have much experience working with connections, but it looks like that there is no correct way to use dbcp2 pools with derby databases.

Here is full stack trace:

java.sql.SQLException: Cannot create PoolableConnectionFactory (Cannot close a connection while a transaction is still active.)
        at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2385)
        at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2110)
        at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
        at org.apache.jmeter.protocol.jdbc.config.DataSourceElement$DataSourceComponentImpl.getConnection(DataSourceElement.java:361)
        at org.apache.jmeter.protocol.jdbc.config.DataSourceElement.getConnection(DataSourceElement.java:197)
        at org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler.sample(JDBCSampler.java:79)
        at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:627)
        at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:551)
        at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:490)
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: Cannot close a connection while a transaction is still active.
        at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
        at org.apache.derby.client.am.ClientConnection.closeResourcesX(Unknown Source)
        at org.apache.derby.client.am.ClientConnection.closeX(Unknown Source)
        at org.apache.derby.client.am.ClientConnection.close(Unknown Source)
        at org.apache.derby.client.net.NetConnection.close(Unknown Source)
        at org.apache.commons.dbcp2.DelegatingConnection.closeInternal(DelegatingConnection.java:239)
        at org.apache.commons.dbcp2.PoolableConnection.reallyClose(PoolableConnection.java:232)
        at org.apache.commons.dbcp2.PoolableConnectionFactory.destroyObject(PoolableConnectionFactory.java:367)
        at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2402)
        at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2381)
        ... 10 more
Caused by: ERROR 25001: Cannot close a connection while a transaction is still active.
        at org.apache.derby.client.am.ClientConnection.checkForTransactionInProgress(Unknown Source)
        ... 19 more


Отправлено с iPhone

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [dbcp]

garydgregory
You might want to provide a reproducible test case, either as a PR
preferably, or a maybe a Gist.

Gary

On Fri, Dec 20, 2019 at 10:28 AM DmitrI Sherstobitov
<[hidden email]> wrote:

> Hi.
>
> I have a question about supporting derby database in dbcp2. I’m using
> JMeter to test derby dB and in case of auroCommit=false there is exception
> occurs on connection validation step.
>
> Using rollbackOnReturn and setEnableAutoCommitOnReturn booleans actually
> breaks all logic. ( because in first case we lose all data on rollback in
> second case we set autoCommit to true always for connection)
>
> I doesn’t have much experience working with connections, but it looks like
> that there is no correct way to use dbcp2 pools with derby databases.
>
> Here is full stack trace:
>
> java.sql.SQLException: Cannot create PoolableConnectionFactory (Cannot
> close a connection while a transaction is still active.)
>         at
> org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2385)
>         at
> org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2110)
>         at
> org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
>         at
> org.apache.jmeter.protocol.jdbc.config.DataSourceElement$DataSourceComponentImpl.getConnection(DataSourceElement.java:361)
>         at
> org.apache.jmeter.protocol.jdbc.config.DataSourceElement.getConnection(DataSourceElement.java:197)
>         at
> org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler.sample(JDBCSampler.java:79)
>         at
> org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:627)
>         at
> org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:551)
>         at
> org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:490)
>         at
> org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
>         at java.lang.Thread.run(Thread.java:748)
> Caused by: java.sql.SQLException: Cannot close a connection while a
> transaction is still active.
>         at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown
> Source)
>         at org.apache.derby.client.am.SqlException.getSQLException(Unknown
> Source)
>         at org.apache.derby.client.am.ClientConnection.closeResourcesX(Unknown
> Source)
>         at org.apache.derby.client.am.ClientConnection.closeX(Unknown
> Source)
>         at org.apache.derby.client.am.ClientConnection.close(Unknown
> Source)
>         at org.apache.derby.client.net.NetConnection.close(Unknown Source)
>         at
> org.apache.commons.dbcp2.DelegatingConnection.closeInternal(DelegatingConnection.java:239)
>         at
> org.apache.commons.dbcp2.PoolableConnection.reallyClose(PoolableConnection.java:232)
>         at
> org.apache.commons.dbcp2.PoolableConnectionFactory.destroyObject(PoolableConnectionFactory.java:367)
>         at
> org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2402)
>         at
> org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2381)
>         ... 10 more
> Caused by: ERROR 25001: Cannot close a connection while a transaction is
> still active.
>         at org.apache.derby.client.am.ClientConnection.checkForTransactionInProgress(Unknown
> Source)
>         ... 19 more
>
>
> Отправлено с iPhone
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>