Hi,
When we write JDBC code, is it okay if we depend on auto commit in the
connection we get from the DataSource?
The JDBC Reporter for Metrics [1] depends on auto commit "true" value set
in the DataSource configuration. The JDBC reporter doesn't have any complex
transactions and I thought it
Depending on it might cause issues. API Manager had to face some
complexities on Postgre. These however were because API Manager depended on
defaultAutoCommit to be false, not true. I guess it can have its
complications on various DB engines.
And as a best practise I think its better to not
Isuru,
By allowing autocommit = true, your giving control of your JDBC logic
completely to database engine.
This will be problematic when you want to perform a rollback resulted by
multiple SQL statements.
For example:
with autocommit=true
insertOrder()
Hi Sumedha, Nuwan,
Yes, I understand that we shouldn't be using auto commit if we need to
rollback multiple transactions. In Metrics reporter, it just does a batch
insert and it has only one transaction. So, there were no issues with auto
commit yet.
I thought of asking question as we also let