问题描述
我正在尝试使用 java 模拟数据库恢复子系统.但是,我有以下问题.
I am trying to simulate a database recovery subsystem using java. However, I have the following questions.
每当发出开始事务时,是否总是需要结束事务?(就像下面的例子)
Whenever begin transaction is issued, is it always necessary that there should be an end transaction? (Like the below example)
b1 --- Begin txn 1
r1(X) --- Read item X using txn 1
e1 --- End txn 1
根据上面的示例,我没有发布 Commit 交易声明.那么,我的交易会成功还是失败?如果上面的例子如下,
As per the above example, I am not issuing a Commit transaction statement. So, will my transaction succeed or fail? If the above example, is as below,
b1 --- Begin txn 1
r1(X) --- Read item X using txn 1
c1 --- commit txn 1
结束和提交有什么区别?
what is the difference between end and commit?
如果您需要更多信息,请告诉我.
Please let me know if you need more information.
推荐答案
无论是 ROLLBACK a Transaction 还是 COMMIT a Transaction.我希望你不要把它与不是事务且与事务无关的 BEGIN 和 END 块混淆完全没有.
Either you ROLLBACK a Transaction Or COMMIT a Transaction.I hope you are not confusing it with BEGIN and END block which is not a transaction and nothing to do with Transaction at All.
我相信大多数数据库......它仍然以回滚或提交结束.
I believe in most databases .... still it ends with a ROLL BACK or COMMIT.
希望这会有所帮助.
这篇关于END 事务和 COMMIT 事务的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!