Java JDBC savePoint [英] Java JDBC savePoint

查看:111
本文介绍了Java JDBC savePoint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读

http://download.oracle.com/javase/6/docs/api/java/sql/Savepoint.html

从数据库的角度来看,没有详细说明保存点的映射。

it is not well spelled out what savepoints are mapped from database perspective.

设置保存点时,数据库更改是否可用于其他事务?

When savepoints are set, are the database changes made available to other transactions?

谢谢

推荐答案

保存点标记当前事务可以回滚的点。它可以选择仅回滚其中的一些,而不是将所有更改都回滚。例如,假设您:

A savepoint marks a point that the current transaction can roll back to. Instead of rolling all of its changes back, it can choose to roll back only some of them. For example, suppose you:


  • 开始交易,

  • 在表格中插入10行,

  • 设置保存点,

  • 再插入5行,

  • 回滚到保存点,

  • 提交交易。

  • start a transaction,
  • insert 10 rows into a table,
  • set a savepoint,
  • insert another 5 rows,
  • rollback to the savepoint,
  • commit the transaction.

执行此操作后,表格将包含您插入的前10行。其他5行将被回滚删除。

After doing this, the table will contain the first 10 rows you inserted. The other 5 rows will have been deleted by the rollback.

设置保存点不会将任何数据保存到数据库中。它不会使数据库更改对任何其他事务可见。保存点只是当前事务可以回滚的标记。

Setting a savepoint doesn't 'save' any data to the database. It doesn't make database changes visible to any other transaction. A savepoint is just a marker that the current transaction can roll back to.

这篇关于Java JDBC savePoint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆