我已注意到一些方案管理员使用<代码>COMMIT 采用conn.setAutoCommit(true);
以终止交易或退回,从而使用一种而不是另一种方式的好处?
主要区别在哪里?
conn.setAutoCommit(true);
页: 1
statement.executeQuery(query);
statement.commit();
我已注意到一些方案管理员使用<代码>COMMIT 采用conn.setAutoCommit(true);
以终止交易或退回,从而使用一种而不是另一种方式的好处?
主要区别在哪里?
conn.setAutoCommit(true);
页: 1
statement.executeQuery(query);
statement.commit();
您一般应使用<代码>Connection.commit()而不是Connection.setAutoCommit(true)
进行交易,除非您希望从利用交易转向按照汽车通信模式进行交易。
尽管如此,在交易中将进行交易(如果驾驶人符合JDBC 4.1光谱第10.1节),则打上<条码>Connection.setAutoCommit(true)。 但是,如果你打算在此之后留在汽车公司,那么,由于能够/拆开连接上的汽车,其连接的间接费用可能比仅仅承诺的要高(例如,它需要在交易经理之间开关,进行更多的检查等)。
您还应使用<条码>Connection.commit(,而不使用本地的“K”条码
<>说明: 在配置<代码>Connection时,亚洲开发银行的应用程序应当使用适当的<代码>Connection方法,例如
setAutoCommit
或set TransactionIsolation
。 申请不应直接援引KQ指挥系统,以改变现有的JDBC方法时的联系配置。
确实,诸如<代码>commit()和setAutoCommit(boolean)
等指挥系统可以在背景中开展更多的工作,例如封闭式<代码>ResultSets和封闭式或重订Statements
。 利用“指挥编码”<条码>COMMIT,将绕过这一条,并可能使你的驾驶员/联系成为一个不正确的国家。
<代码>conn.setAutoCommit(>); 适用于该链接,并允许执行。 单项交易中的X询问,或每条<代码>execute
As the API describes:
void setAutoCommit(boolean autoCommit)
throws SQLException
Sets this connection s auto-commit mode to the given state. If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either the method commit or the method rollback. By default, new connections are in auto-commit mode
简单:
conn.setAutoCommit(false);
statement.executeQuery(query);
statement.commit();
将与下列各点相同:
conn.setAutoCommit(true);
statement.executeQuery(query);
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...