JavaWeb学习(二十九)———— 事务

时间:2023-12-19 21:29:02

一、事务的概念

  事务指逻辑上的一组操作,组成这组操作的各个单元,要不全部成功,要不全部不成功
  例如:A——B转帐,对应于如下两条sql语句
    update from account set money=money+100 where name='B';
    update from account set money=money-100 where name='A';

二、MySQL数据库中操作事务命令

  1、编写测试SQL脚本,如下:

JavaWeb学习(二十九)———— 事务
 1 /*创建账户表*/
2 create table account(
3 id int primary key auto_increment,
4 name varchar(40),
5 money float
6 );
7
8 /*插入测试数据*/
9 insert into account(name,money) values('A',1000);
10 insert into account(name,money) values('B',1000);
11 insert into account(name,money) values('C',1000);
JavaWeb学习(二十九)———— 事务

  下面我们在MySQL数据库中模拟A——B转帐这个业务场景

2.1、开启事务(start transaction)

  使用"start transaction"开启MySQL数据库的事务,如下所示:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbIAAADQCAIAAADtWnOuAAASaElEQVR4nO3dW5IcxRWA4VwCOzA74J0X4QBkCQSDpJnR3CQBkuaiERIIxO3BwQYcMQuwvQI/64Ww6Q3YC0CswA94AQ5H+2Hc5azKzJMns7Iu2f1/oSCqs7NOnrrkoXr6Uubo/DsDAGgcnX8/dQoAMCeURQBooSwCQAtlEQBaKIsA0EJZBIAWyiIAtIxTFhcWt338cWeoljyB9Tfm1aJ32o9QC4oMMUL5NqPsjZnb8M3HLExeFoX2occdLoLdX7Mu1fCSsB+4msZ4js6/XziaZ0PTO/Ti1G4MPetNQ3nGR8dVlt2kOML+yUhV6ByK4HYolWfq/szYb6Hl1Pz1GwX01ZRFs3r9Ip/Nmg5GnOehTKInfalxM+IkTUh3ems23Nuts88X6gOUl/O0y6k5A0PJKItGUX2iHfRPRbstHPJaof790wtlpewsBLH7RA+K202TZHQ/aNr7LCtzBgaXVxa9LdGplTrfQlLnkrK/EKdPhpp1k1KKHiD3OCYlmbp/NHGUY0UPQdJRADLJZdFYp2Of0z210avUuH2m60AzMxQ2ujneZWWqfY7pEMtG3M+LFWGLgDLssngp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2AGbq2u6Z/VA4F92zIdRZOC30J40QP5qqPrhmFaFn6CnvTpNDyUO7MUODZuQpr5IUx91kzQZ64wtDRPsLcYQ0MrbX2x4dDnN3deekWU46kzLUGBnAxrm6fRLv1M/Q1RYASrKvFgEA5nc7p1OnAABzcv3OWbwTAGyO9/bPp04BAObkxuGTqVMAgDnZuvds6hQAYE6EG6ICwCbamesNUQFgGneOZ3pDVACYxt7JN1OnAABzsn9KWQQAC1eLANDC3xYBwPZfa6AgcOp9JmsAAAAASUVORK5CYII=" alt="" />

  我们首先在数据库中模拟转账失败的场景,首先执行update语句让A用户的money减少100块钱,如下图所示:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdIAAAGqCAIAAAAwc1LNAAAgAElEQVR4nO3de5RdVZ3g8fsvRM2gBSjYqDiD42MN2jMu1/Q4I804OCohkE5CIAnKK8hLFHwAvaadgW6Xq3u623YEOzwa7CCCBDCEpAIquRIk76q8U5VHVVIhSVUqqapbj1RVKlnOH0Uup87Ze5/fPo997q77/axarFP77vPbv73P2b9ckvsovbajd+WO3o6jw1de/60SACBvK1v6Vrb0dRwbuer6bxedCwDUgXJLpdxSOXBs5Krr7y46FwCoA9WyO+MGyi4A5K/c0ldu6TtwbGQGf8kAAA6s3Nm7cmfvgWPDlF0AcOG17cdW7jjWcWx4Bq9kAAAHfru1+3fbjnYcPX7V1+8qOhcAqAOvbO76zZau/d1DbspuOSDa7iABW8rEQlNQzsilwhMAYGH5xkMrmg/vPzJ05de+6WxQQy1zloOQLqtQe4bJJ4tTm6sHQGHpugPLNx7c1zU4/bo7nQ0qrGW1LKeymziO/ESeGgMFW7J639K1He2dA1fMv6McUe0W/X/q4HF0GwcbdY8q85FUBF0yknzk5cawDsnabYMr52g1rvkU4ToAyNgLb7QtWb2vrbN/2rzbq7uxHCmXymNJaVDucPO2jy0KtuPG5pNyLN1DCfKJXa40+QCoCc+v2vPr1e1thyvT5t4WrBeljKpqbAf5Q5L4huGCzPElY0nKXIJpW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o63yPdYsDQon6mlfPZnjmP1J4SuvyS+ZAhziRSGkvS3ykc4X0mG8qUGEOOme5OX3ZKqUpRUz9qUkeUDGU6UBJHkkzg3Q//ggkhimvuby6IumTTHupgAUlnwlz++7X8/VF637ZKvzhpvsdpgwVoQPdAdC8tQaBTlrwkqUTT5aEWzrTKx8SUxJf3zmK8kpu2CANC67QcPffOvH3l9w45LL796vMVqg8WWBuWxsAzpRrEtGZI45p4JgpcCZU4YU9I/j/kKExMOCiDGXX/z6D1/+/M3mlqqLyDLr+yWJlbeTMqHJI6uv8s8db9K+uc9X3N8qxUAEO97f/+L+3/yq9Vb9lw2Y345wnyuoafuIdtypkzJtgzF5mOeQmzw6Fm6/GPj6/ob8jSkIZ+vuV0yIgCpv/rZrx94dNm67fu/POv6onMBgDrwo0W/+7unf9+069C0a24uOhcAqAM/eWHdT5c0bWnrvnL+rUXnAgB14LFXW/7lt7u3d/TNvP6bRecCAHXgqTcOPP2Hgy2HBmffdHfRuQBAHVi84djzG/kuNQBwZcmWwSVbB/nmYABwZNnO0WU7R9uOnZx3231F5wIAdWB569jy1rH2nlPzbr+/6FwAYPL7//qpxbj3mzovAAAAAElFTkSuQmCC" alt="" />

  然后我们关闭当前操作的dos命令行窗口,这样就导致了刚才执行的update语句的数据库的事务没有被提交,那么我们对A用户的修改就不算是是真正的修改了,下次在查询A用户的money时,依然还是之前的1000,如下图所示:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXEAAABfCAIAAACRNGABAAAHFklEQVR4nO3da2/URhTG8X1baAuE3EMSkkACIpQW0aJKVSXUN1Wl9tNBwgILixJupRLtN9hv1r5i63guPmd8fBnn/xOqzGR25pmxfboK3mT0xaXFx0fjhcWVEQDUR00BYImaAsASNQWApTZryqzAbW8hgDBPD+WSs//O506GlqxtF2n/fYo3boen2WTqRsPPE57Dm6HEZPnncBsjN539/diTmhJpb1r9ebUjFPtLXnsO7wEvq304h/vpLjl+EcZv0ordm9eUmaNy+lCdKzbK48a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.2、提交事务(commit)

  下面我们在数据库模拟A——B转账成功的场景

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAywAAAF5CAIAAADyMDmnAAAgAElEQVR4nO3dWZAcx33n8Xq1LIskrrkwJwYDYDAACAIQCJAiwAPUSZGieEgiRVqkRMuSLcduOCyFX2Tvw0bs0/pBBDAABhhgQBzEJfDUAYPtK7RhhUSvZEuWJZISD5EgboKgxpbW2IcR2jVVmf/6Z1ZVV1f19xMdjJ7qrMx/Zg8rf+ie6QkO/+0/vfjaqQ994qEAAAAAmZqcnHzllVdef/3106dPnw05d+5ccLj2/AuvnfzgPb9fdJGAZF0QHC+6BgAAXMkh7HsvvHbyA3c/WHSRgNlU/LoUBJeKrgQAAFdSCDtS+/4Lr578wF0PFF2k2SVuVbwprQvFL6cTAQBoElIIO/o3z7/4WlOHMFSM5jmNx68mDGGu9ejbN9tMAQDepBD21D/84KVfnvpgs74dyW5UPfJzaotf9dtzQXA4CL4aBA8Ewbog6E1RRvoX7Zy+PwlhANCCpBD2zf/zo5+/cebD936m6CLN2I2qx/acJsYv4fZ8EDwXBF8Ngq8GwbogWJauHuG7Thna0rw5m/I9XABAU5FC2PHv/+zlE2dv+9TDRRdpxt5TPfHnNE38Em4vBsFzQbA9CL4aBLcHwTp1PXIIc5qa/tF6G6d6AABNTgphf/uDn7968vwd9z/SgDpqIfHjxlPYfhpGeBayZQxhz+UQwpSvJ+UXwjxeA4vf4X8BACg1KYR958ev/fL0hTsf/MOGVWPc7G0JwHUHyipGuPbTmPiSnlBngSFsSlZR7KUgqAVBLQj+Kgj+Igj+IgjWB8F6+3uUuYYw/ZfxrohfAFABUgj7x5+eeP3Mxbs+88WGVWPb7I3HnfahrGKEaz8Niy8pNaBO4yudEfJzmhjFXDNWItcQpn9xy+NluWD6Q0QxACg7KYR974WTb5y7ePdDf1SLqZ8f/jJ+3/b24tRBpzcf4w8ZdyChyMSHEosU+hFqjrcXFkFTf+J8XY8L80rTj201bMsV6FKFLYplx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commit)数据库事务之后,A——B转账100块钱的这个业务操作算是真正成功了,A账户中少了100,B账户中多了100。

2.3、回滚事务(rollback)

  JavaWeb学习(二十九)———— 事务

  通过手动回滚事务,让所有的操作都失效,这样数据就会回到最初的初始状态!

三、JDBC中使用事务

  当Jdbc程序向数据库获得一个Connection对象时,默认情况下这个Connection对象会自动向数据库提交在它上面发送的SQL语句。若想关闭这种默认提交方式,让多条SQL在一个事务中执行,可使用下列的JDBC控制事务语句

  • Connection.setAutoCommit(false);//开启事务(start transaction)
  • Connection.rollback();//回滚事务(rollback)
  • Connection.commit();//提交事务(commit)

3.1、JDBC使用事务范例

  在JDBC代码中演示银行转帐案例,使如下转帐操作在同一事务中执行

  "update account set money=money-100 where name='A'"

  update account set money=money+100 where name='B'

  代码如下:

JavaWeb学习(二十九)———— 事务
  1 package me.gacl.demo;
2
3 import java.sql.Connection;
4 import java.sql.PreparedStatement;
5 import java.sql.ResultSet;
6 import java.sql.SQLException;
7 import me.gacl.utils.JdbcUtils;
8 import org.junit.Test;
9
10 /**
11 * @ClassName: TransactionDemo1
12 * @Description:
13 * JDBC中使用事务来模似转帐
14 create table account(
15 id int primary key auto_increment,
16 name varchar(40),
17 money float
18 );
19 insert into account(name,money) values('A',1000);
20 insert into account(name,money) values('B',1000);
21 insert into account(name,money) values('C',1000);
22 * @author: 孤傲苍狼
23 * @date: 2014-9-22 下午11:16:17
24 *
25 */
26 public class TransactionDemo1 {
27
28 /**
29 * @Method: testTransaction1
30 * @Description: 模拟转账成功时的业务场景
31 * @Anthor:孤傲苍狼
32 *
33 */
34 @Test
35 public void testTransaction1(){
36 Connection conn = null;
37 PreparedStatement st = null;
38 ResultSet rs = null;
39
40 try{
41 conn = JdbcUtils.getConnection();
42 conn.setAutoCommit(false);//通知数据库开启事务(start transaction)
43 String sql1 = "update account set money=money-100 where name='A'";
44 st = conn.prepareStatement(sql1);
45 st.executeUpdate();
46 String sql2 = "update account set money=money+100 where name='B'";
47 st = conn.prepareStatement(sql2);
48 st.executeUpdate();
49 conn.commit();//上面的两条SQL执行Update语句成功之后就通知数据库提交事务(commit)
50 System.out.println("成功!!!"); //log4j
51 }catch (Exception e) {
52 e.printStackTrace();
53 }finally{
54 JdbcUtils.release(conn, st, rs);
55 }
56 }
57
58 /**
59 * @Method: testTransaction1
60 * @Description: 模拟转账过程中出现异常导致有一部分SQL执行失败后让数据库自动回滚事务
61 * @Anthor:孤傲苍狼
62 *
63 */
64 @Test
65 public void testTransaction2(){
66 Connection conn = null;
67 PreparedStatement st = null;
68 ResultSet rs = null;
69
70 try{
71 conn = JdbcUtils.getConnection();
72 conn.setAutoCommit(false);//通知数据库开启事务(start transaction)
73 String sql1 = "update account set money=money-100 where name='A'";
74 st = conn.prepareStatement(sql1);
75 st.executeUpdate();
76 //用这句代码模拟执行完SQL1之后程序出现了异常而导致后面的SQL无法正常执行,事务也无法正常提交,此时数据库会自动执行回滚操作
77 int x = 1/0;
78 String sql2 = "update account set money=money+100 where name='B'";
79 st = conn.prepareStatement(sql2);
80 st.executeUpdate();
81 conn.commit();//上面的两条SQL执行Update语句成功之后就通知数据库提交事务(commit)
82 System.out.println("成功!!!");
83 }catch (Exception e) {
84 e.printStackTrace();
85 }finally{
86 JdbcUtils.release(conn, st, rs);
87 }
88 }
89
90 /**
91 * @Method: testTransaction1
92 * @Description: 模拟转账过程中出现异常导致有一部分SQL执行失败时手动通知数据库回滚事务
93 * @Anthor:孤傲苍狼
94 *
95 */
96 @Test
97 public void testTransaction3(){
98 Connection conn = null;
99 PreparedStatement st = null;
100 ResultSet rs = null;
101
102 try{
103 conn = JdbcUtils.getConnection();
104 conn.setAutoCommit(false);//通知数据库开启事务(start transaction)
105 String sql1 = "update account set money=money-100 where name='A'";
106 st = conn.prepareStatement(sql1);
107 st.executeUpdate();
108 //用这句代码模拟执行完SQL1之后程序出现了异常而导致后面的SQL无法正常执行,事务也无法正常提交
109 int x = 1/0;
110 String sql2 = "update account set money=money+100 where name='B'";
111 st = conn.prepareStatement(sql2);
112 st.executeUpdate();
113 conn.commit();//上面的两条SQL执行Update语句成功之后就通知数据库提交事务(commit)
114 System.out.println("成功!!!");
115 }catch (Exception e) {
116 try {
117 //捕获到异常之后手动通知数据库执行回滚事务的操作
118 conn.rollback();
119 } catch (SQLException e1) {
120 e1.printStackTrace();
121 }
122 e.printStackTrace();
123 }finally{
124 JdbcUtils.release(conn, st, rs);
125 }
126 }
127 }
JavaWeb学习(二十九)———— 事务

3.2、设置事务回滚点

  在开发中,有时候可能需要手动设置事务的回滚点,在JDBC中使用如下的语句设置事务回滚点

  Savepoint sp = conn.setSavepoint();
  Conn.rollback(sp);
  Conn.commit();//回滚后必须通知数据库提交事务
  设置事务回滚点范例

JavaWeb学习(二十九)———— 事务
 1 package me.gacl.demo;
2
3 import java.sql.Connection;
4 import java.sql.PreparedStatement;
5 import java.sql.ResultSet;
6 import java.sql.SQLException;
7 import java.sql.Savepoint;
8
9 import me.gacl.utils.JdbcUtils;
10 import org.junit.Test;
11
12 /**
13 * @ClassName: TransactionDemo1
14 * @Description:
15 * JDBC中使用事务来模似转帐
16 create table account(
17 id int primary key auto_increment,
18 name varchar(40),
19 money float
20 );
21 insert into account(name,money) values('A',1000);
22 insert into account(name,money) values('B',1000);
23 insert into account(name,money) values('C',1000);
24 * @author: 孤傲苍狼
25 * @date: 2014-9-22 下午11:16:17
26 *
27 */
28 public class TransactionDemo2 {
29
30 /**
31 * @Method: testTransaction1
32 * @Description: 模拟转账成功时的业务场景
33 * @Anthor:孤傲苍狼
34 *
35 */
36 @Test
37 public void testTransaction1(){
38 Connection conn = null;
39 PreparedStatement st = null;
40 ResultSet rs = null;
41 Savepoint sp = null;
42
43 try{
44 conn = JdbcUtils.getConnection();
45 conn.setAutoCommit(false);//通知数据库开启事务(start transaction)
46
47 String sql1 = "update account set money=money-100 where name='A'";
48 st = conn.prepareStatement(sql1);
49 st.executeUpdate();
50
51 //设置事务回滚点
52 sp = conn.setSavepoint();
53
54 String sql2 = "update account set money=money+100 where name='B'";
55 st = conn.prepareStatement(sql2);
56 st.executeUpdate();
57
58 //程序执行到这里出现异常,后面的sql3语句执行将会中断
59 int x = 1/0;
60
61 String sql3 = "update account set money=money+100 where name='C'";
62 st = conn.prepareStatement(sql3);
63 st.executeUpdate();
64
65 conn.commit();
66
67 }catch (Exception e) {
68 try {
69 /**
70 * 我们在上面向数据库发送了3条update语句,
71 * sql3语句由于程序出现异常导致无法正常执行,数据库事务而已无法正常提交,
72 * 由于设置的事务回滚点是在sql1语句正常执行完成之后,sql2语句正常执行之前,
73 * 那么通知数据库回滚事务时,不会回滚sql1执行的update操作
74 * 只会回滚到sql2执行的update操作,也就是说,上面的三条update语句中,sql1这条语句的修改操作起作用了
75 * sql2的修改操作由于事务回滚没有起作用,sql3由于程序异常没有机会执行
76 */
77 conn.rollback(sp);//回滚到设置的事务回滚点
78 //回滚了要记得通知数据库提交事务
79 conn.commit();
80 } catch (SQLException e1) {
81 e1.printStackTrace();
82 }
83 e.printStackTrace();
84 }finally{
85 JdbcUtils.release(conn, st, rs);
86 }
87 }
88 }
JavaWeb学习(二十九)———— 事务

四、事务的四大特性(ACID)

4.1、原子性(Atomicity)

  原子性是指事务是一个不可分割的工作单位,事务中的操作要么全部成功,要么全部失败。比如在同一个事务中的SQL语句,要么全部执行成功,要么全部执行失败

4.2、一致性(Consistency)

  官网上事务一致性的概念是:事务必须使数据库从一个一致性状态变换到另外一个一致性状态。以转账为例子,A向B转账,假设转账之前这两个用户的钱加起来总共是2000,那么A向B转账之后,不管这两个账户怎么转,A用户的钱和B用户的钱加起来的总额还是2000,这个就是事务的一致性。

4.3、隔离性(Isolation)

  事务的隔离性是多个用户并发访问数据库时,数据库为每一个用户开启的事务,不能被其他事务的操作数据所干扰,多个并发事务之间要相互隔离。

4.4、持久性(Durability)

  持久性是指一个事务一旦被提交,它对数据库中数据的改变就是永久性的,接下来即使数据库发生故障也不应该对其有任何影响

  事务的四大特性中最麻烦的是隔离性,下面重点介绍一下事务的隔离级别

五、事务的隔离级别

  多个线程开启各自事务操作数据库中数据时,数据库系统要负责隔离操作,以保证各个线程在获取数据时的准确性。

5.1、事务不考虑隔离性可能会引发的问题  

  如果事务不考虑隔离性,可能会引发如下问题:

  1、脏读

     脏读指一个事务读取了另外一个事务未提交的数据

     这是非常危险的,假设A向B转帐100元,对应sql语句如下所示
          1.update account set money=money+100 where name='B';    
          2.update account set money=money-100  where name='A';
        当第1条sql执行完,第2条还没执行(A未提交时),如果此时B查询自己的帐户,就会发现自己多了100元钱。如果A等B走后再回滚,B就会损失100元。  

  2、不可重复读

  不可重复读指在一个事务内读取表中的某一行数据,多次读取结果不同。
  例如银行想查询A帐户余额,第一次查询A帐户为200元,此时A向帐户内存了100元并提交了,银行接着又进行了一次查询,此时A帐户为300元了。银行两次查询不一致,可能就会很困惑,不知道哪次查询是准的。
  不可重复读和脏读的区别是,脏读是读取前一事务未提交的脏数据,不可重复读是重新读取了前一事务已提交的数据
  很多人认为这种情况就对了,无须困惑,当然是后面的为准。我们可以考虑这样一种情况,比如银行程序需要将查询结果分别输出到电脑屏幕和写到文件中,结果在一个事务中针对输出的目的地,进行的两次查询不一致,导致文件和屏幕中的结果不一致,银行工作人员就不知道以哪个为准了。

  3、虚读(幻读)

  虚读(幻读)是指在一个事务内读取到了别的事务插入的数据,导致前后读取不一致
  如丙存款100元未提交,这时银行做报表统计account表中所有用户的总额为500元,然后丙提交了,这时银行再统计发现帐户为600元了,造成虚读同样会使银行不知所措,到底以哪个为准。

5.2、事务隔离性的设置语句

  MySQL数据库共定义了四种隔离级别:

  1. Serializable(串行化):可避免脏读、不可重复读、虚读情况的发生。
  2. Repeatable read(可重复读):可避免脏读、不可重复读情况的发生。
  3. Read committed(读已提交):可避免脏读情况发生。
  4. Read uncommitted(读未提交):最低级别,以上情况均无法保证。

  mysql数据库查询当前事务隔离级别:select @@tx_isolation

  例如:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQUAAACWCAIAAABYcQqfAAAI00lEQVR4nO2d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aV/NY9DCXDfQQ7UtnY22mB0+rjZoXetiZlZ+nb48ZO243hz0SilvP1MjHs6t7XvaUE5+nZzPq/GDXtelZtNeaT3Nl2Pvb0c5fI7QOHXne4fwwlx0/PzTHbYf2SIcePPlrhPx05HkHPcxlx+tLmp+7/XH00Oy2kB9Pnv4SGMYQZsj9h+Kom0QxLvoR7cWURFeavejcmaeYcIHotmNenojoYS7cnz4XlGAu6OFcUIK5oIdzQQnmgh7OBSWYC3o4F5RgLvz99Ol+YCJ8vwZABj0AZNADQIbvb70A1GsY6OECUK9h8P8/nHdcqxf0w/nhAlCvYaCHC0C9hsH1JYAMegDIoAeADHoAyKAHgAx6AMigB4AMegDIoAeAjHZ/er+MBE50/7VINfpwkWa/10NKJ1r5MdR6OOAS7JJSR0SxibWX/sOjfsZywH6YyFIPu/wGOiYdi1AfshzxLKxmH/UznCfUEmvOD1rN0uPzezGovbRDaM6jqYota/v3hBDNisVputLso36i8/V4dq7D6Vn5fqkuVZJ+n4me/YGMA/3N4d8O5WbYLxfE41Oz7/azcrs5wQsyRA9a/bRtZ12LKOJLpxPR7FZh26/x7/Gp2Uf9ePKJrmF0Qc7KqPODNihu++sqRonW0uPHtuxwnhb95/Sp2Xe0r2ipHehMzBPx9Gyph1TVuC9KtDk0+y3z1F567J1tLRqs2XaGuxTa9SV/n4mW2q5on4kp2fULpeqZQtN5fZSWf9O/Zm/4MdLwz9ceb4a7DtyfBsigB4AMegDIoAeADHoAyKAHgAx6ALjzH2kzr4IxC1XHAAAAAElFTkSuQmCC" alt="" />

  mysql数据库默认的事务隔离级别是:Repeatable read(可重复读)

  mysql数据库设置事务隔离级别:set transaction isolation level 隔离级别名

  例如:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAApoAAACeCAIAAAAdYD2XAAAaIElEQVR4nO2dTc7rOHaGzxLuDm7toDL25N4VVGcBwc3MkyDd8wBB1wKStBdQSRbQQXpmNNBByuMgf3N3+i4gSNW0Bqk4gw9m0Tw/OpRkS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ADwiuTlHAAAAFYKcg4AALB5kHMAAIDNk98VDjYH9QgA8Cog508M9QgA8Co0cp7ZM5zwlYd79QgAAE8Lo/MnhnoEAHgVkPMnhnoEAHgVWNkOAACweZBzAACAzYOcAwAAbB7kHAAAYPMg5wAAAJsHOQcAANg8yDkAAMDW+X8x4/O4bvk+AgAAAABJRU5ErkJggg==" alt="" />

5.3、使用MySQL数据库演示不同隔离级别下的并发问题

  同时打开两个窗口模拟2个用户并发访问数据库

1、当把事务的隔离级别设置为read uncommitted时,会引发脏读、不可重复读和虚读

  A窗口
    set transaction isolation level  read uncommitted;--设置A用户的数据库隔离级别为Read uncommitted(读未提交)
    start transaction;--开启事务
    select * from account;--查询A账户中现有的钱,转到B窗口进行操作
    select * from account--发现a多了100元,这时候A读到了B未提交的数据(脏读)

  B窗口
    start transaction;--开启事务
    update account set money=money+100 where name='A';--不要提交,转到A窗口查询

2、当把事务的隔离级别设置为read committed时,会引发不可重复读和虚读,但避免了脏读

  A窗口
    set transaction isolation level  read committed;
    start transaction;
    select * from account;--发现a帐户是1000元,转到b窗口
    select * from account;--发现a帐户多了100,这时候,a读到了别的事务提交的数据,两次读取a帐户读到的是不同的结果(不可重复读)
  B窗口
    start transaction;
    update account set money=money+100 where name='aaa';
    commit;--转到a窗口

3、当把事务的隔离级别设置为repeatable read(mysql默认级别)时,会引发虚读,但避免了脏读、不可重复读

  A窗口
    set transaction isolation level repeatable read;
    start transaction;
    select * from account;--发现表有4个记录,转到b窗口
    select * from account;--可能发现表有5条记录,这时候发生了a读取到另外一个事务插入的数据(虚读)
  B窗口
    start transaction;
    insert into account(name,money) values('ggg',1000);
    commit;--转到a窗口

4、当把事务的隔离级别设置为Serializable时,会避免所有问题

  A窗口
    set transaction isolation level Serializable;
    start transaction;
    select * from account;--转到b窗口

  B窗口
    start transaction;
    insert into account(name,money) values('ggg',1000);--发现不能插入,只能等待a结束事务才能插入