在SELECT语句JDBC的autoCommit = false连接上调用commit? [英] Call commit on autoCommit=false connection for SELECT statements JDBC?
问题描述
我在Tomcat上确实有一个用Java编写的webapp,默认情况下所有连接都应为autoCommit=false
.现在,如果我确实仅在事务中运行SELECT语句.我仍然需要呼叫commit()
还是仅仅为了关闭连接就足够了?
I do have a webapp written in Java on Tomcat, all connections should be autoCommit=false
by default. Now, if I do run SELECT statement only in a transaction. Do I still need to call commit()
or is it sufficient just to close the connection?
它的价值:我使用的是Oracle 11.2.
For what it's worth: I am on Oracle 11.2.
有一个类似的问题,但实际上并未给出这种情况的答案.
There is a similar question but does not actually give an answer for this case.
推荐答案
关闭连接就足够了,无需调用commit
或rollback
.
It is sufficient to close the connection, no need to call commit
or rollback
.
但根据连接.close(),它是
But according to connection.close(), it is recommended to call either commit or rollback.
这篇关于在SELECT语句JDBC的autoCommit = false连接上调用commit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!