Hello,

Try calling Connection#setAutoCommit(false) once you get a Connection.
You'll likely want to configure your data source with
org.apache.commons.dbcp2.BasicDataSource.setAutoCommitOnReturn(false)
to avoid resetting the auto-commit flag.

Gary

On Tue, May 31, 2022 at 7:46 PM Sébastien Jachym
<sebastien.jac...@agri-commerce.fr> wrote:
>
> Hy, is a way to fully disabled transactional (autocommit) statement in DBCP
> ?
>
>
>
> Using Database Connection Pools with
> org.apache.commons.dbcp2.BasicDataSource give me statements :
>
>
>
> SET autocommit=1
>
> SET autocommit=0
>
> SET SQL_SELECT_LIMIT=1
>
> select
> date,logger,level,message,exception,pid,idUtilisateur,version,ip,markerSimpleName,sqlLastInsertId,sqlTimeMillis
> from log4j2 where 1=0
>
> SET SQL_SELECT_LIMIT=DEFAULT
>
> insert into log4j2
> (date,logger,level,message,exception,pid,idUtilisateur,version,ip,markerSimpleName,sqlLastInsertId,sqlTimeMillis)
> values
> ('2022-06-01','timertask','TRACE','WaitInitService','','45964','123','null','','','','0')
>
> commit
>
> rollback
>
> SET autocommit=1
>
>
>
> But it's for MySQL MyISAM table, and I didn't need transactions, I whish
> only :
>
>
>
> select
> date,logger,level,message,exception,pid,idUtilisateur,version,ip,markerSimpleName,sqlLastInsertId,sqlTimeMillis
> from log4j2 where 1=0
>
> SET SQL_SELECT_LIMIT=DEFAULT
>
> insert into log4j2
> (date,logger,level,message,exception,pid,idUtilisateur,version,ip,markerSimpleName,sqlLastInsertId,sqlTimeMillis)
> values
> ('2022-06-01','timertask','TRACE','WaitInitService','','45964','123','null','','','','0')
>
>
>
> Thanks for you replys.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to