数据库 4 种隔离级别

int java.sql.Connection.TRANSACTION_SERIALIZABLE = 8 [0x8]隔离性最强

dirty readsnon-repeatable reads and phantom reads are prevented. This level includes the prohibitions in TRANSACTION_REPEATABLE_READ and further prohibits the situation where one transaction reads all rows that satisfy a WHERE condition, a second transaction inserts a row that satisfies that WHERE condition, and the first transaction rereads for the same condition, retrieving the additional "phantom" row in the second read.(即,COMMIT的所有数据看不到 ,包括 更新/插入/删除 的row统统看不到

 

int java.sql.Connection.TRANSACTION_REPEATABLE_READ = 4 [0x4] 隔离性次强

dirty reads and non-repeatable reads are prevented; phantom reads can occur. This level prohibits a transaction from reading a row with uncommitted changes in it, and it also prohibits the situation where one transaction reads a row, a second transaction alters the row, and the first transaction rereads the row, getting different values the second time (a "non-repeatable read").(即,虽然已经 COMMIT 了,依然有一些数据是 看不到 的:  alters  的row看不到。注意:新 插入/删除 的row是可以看到

 

int java.sql.Connection.TRANSACTION_READ_COMMITTED = 2 [0x2]

dirty reads are prevented; non-repeatable reads and phantom reads can occur. This level only prohibits a transaction from reading a row with uncommitted changes in it.(COMMIT 后的数据统统可以看到

 

int java.sql.Connection.TRANSACTION_READ_UNCOMMITTED = 1 [0x1]压根就隔离

dirty readsnon-repeatable reads and phantom reads can occur. This level allows a row changed by one transaction to be read by another transaction before any changes in that row have been committed (a "dirty read"). If any of the changes are rolled back, the second transaction will have retrieved an invalid row.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值