You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Francesco De Angelis <fr...@gmail.com> on 2021/10/02 19:52:05 UTC

Apache Commons DBCP 2.8.0

Hello,
this is my first message, so I hope I will have the opportunity to get some
answers to my question.

I have an application handling a simple pool of connections through a
BasicDataSource object (DBCP 2.8.0). The associated pool is used to load a
database concurrently through several connections.
Due to some design constraints, at the end of the loading either all the
connections are subject to commits or rollbacks, i.e. either the overall
loading process succeeds or fails.
My question is the following: is there a way to enforce such behaviour
through auto-commit=false, or does the library calls rollback() or close()
internally when the connection is released to make it available again from
the pool? In other terms, what happens if neither rollback() nor commit()
is invoked on a connection that released? Is it subject to any default
action?

Thanks a lot for your help.

Best regards,
Francesco De Angelis

Re: Apache Commons DBCP 2.8.0

Posted by Gary Gregory <ga...@gmail.com>.
Hi,

Please see the settings documented on
https://commons.apache.org/proper/commons-dbcp/configuration.html:
enableAutoCommitOnReturn, rollbackOnReturn.

Gary

On Sat, Oct 2, 2021, 16:04 Francesco De Angelis <fr...@gmail.com>
wrote:

> Hello,
> this is my first message, so I hope I will have the opportunity to get some
> answers to my question.
>
> I have an application handling a simple pool of connections through a
> BasicDataSource object (DBCP 2.8.0). The associated pool is used to load a
> database concurrently through several connections.
> Due to some design constraints, at the end of the loading either all the
> connections are subject to commits or rollbacks, i.e. either the overall
> loading process succeeds or fails.
> My question is the following: is there a way to enforce such behaviour
> through auto-commit=false, or does the library calls rollback() or close()
> internally when the connection is released to make it available again from
> the pool? In other terms, what happens if neither rollback() nor commit()
> is invoked on a connection that released? Is it subject to any default
> action?
>
> Thanks a lot for your help.
>
> Best regards,
> Francesco De Angelis
>

Re: Apache Commons DBCP 2.8.0

Posted by Gary Gregory <ga...@gmail.com>.
Also, please use our current version: 2.9.0.

Gary

On Sat, Oct 2, 2021, 16:04 Francesco De Angelis <fr...@gmail.com>
wrote:

> Hello,
> this is my first message, so I hope I will have the opportunity to get some
> answers to my question.
>
> I have an application handling a simple pool of connections through a
> BasicDataSource object (DBCP 2.8.0). The associated pool is used to load a
> database concurrently through several connections.
> Due to some design constraints, at the end of the loading either all the
> connections are subject to commits or rollbacks, i.e. either the overall
> loading process succeeds or fails.
> My question is the following: is there a way to enforce such behaviour
> through auto-commit=false, or does the library calls rollback() or close()
> internally when the connection is released to make it available again from
> the pool? In other terms, what happens if neither rollback() nor commit()
> is invoked on a connection that released? Is it subject to any default
> action?
>
> Thanks a lot for your help.
>
> Best regards,
> Francesco De Angelis
>