本文介绍了在关闭连接时禁用oracle自动提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对关闭连接事件中的Oracle自动提交有疑问.

I have a question about Oracle autocommit on close connection event.

Oracle文档中的信息( http://docs.oracle.com /cd/E16655_01/java.121/e17657.pdf ):

Information from oracle docs(http://docs.oracle.com/cd/E16655_01/java.121/e17657.pdf):

因此,我想以编程方式在JDBC驱动程序中禁用此功能.我不会在连接关闭至少一项交易时不进行自动提交.有可能吗?

So, I want to disable this feature programmatically in JDBC driver. I don't wan't do autocommit on connection close at least one transaction. Is it possible?

P.S. setAutoCommit更改JDBC操作. "Auto_Commit"启动新事务,并在每个语句上调用commit.这不是解决我的问题的方法.

P.S. setAutoCommit change JDBC action. "Auto_Commit" start new transaction and call commit on every statement. It is not solution for my problem.

推荐答案

EDIT.可能重复: Java Connection.close是否回滚?

EDIT. Possible duplicate : Does Java Connection.close rollback?

根据 javadoc ,则应在调用close方法之前尝试提交或回滚.否则结果将由实现定义.

According to the javadoc, you should try to either commit or roll back before calling the close method. The results otherwise are implementation-defined.

这篇关于在关闭连接时禁用oracle自动提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 03:42