Oracle与MySQL中“可串行化”的对比测试
Oracle与MySQL中“可串行化”的对比测试
Thomas Kyte 在“Oracle 9i&10g编程艺术”一书中为了说明事务的隔离级别,提供了一些例子。这里我们来看看“可串行化”级别下的表现。
以普通用户登录系统,并创建测试用的表。
idle> connect scott/tiger
Connected.
scott@FOO> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
scott@FOO> create table a(x int);
Table created.
scott@FOO> create table b(x int);
Table created.
修改事务的隔离级别为“可串行化”
时刻 会话1 会话2
t1 scott@FOO> alter session set isolation_level = serializable;
Session altered.
t2 scott@FOO> alter session set isolation_level = serializable;
相关文档:
我们知道用powerdesigner导出的sql文件后缀为'.sql';用phpmyadmin很容易导入MysQL数据库,但是用PHP怎么导入数据库呢?
我用powerdesigner设计一个数据库后导出sql文件(一个投票系统)为'vote.sql';
文件内容为(一些sql语句和注释):
/*======================= ......
首先你要有tomcat,还要有oracle jdbc的jar档等环境.
第一步: 写JSP
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@(des ......
首先,要下载一个连接mysql数据库的驱动程序: mysql-connector-java-3.0.15-ga-bin.jar, 这个驱动程序不需要做其它配置,也就是说,对于mysql数据库,不必像access或者oracle要建立odbc数据源。
其次,将上面的.jar文件加入到classpath环境变量中。
最后,就是写代码进行测试了。
主要代码如下:
......
管理节点:192.168.50.211 数据节点: 192.168.50.214 数据节点: 192.168.50.215 SQL节点: 192.168.50.212 SQL节点: 192.168.50.213 操作系统:Red Hat Enterprise Linux AS release 5 ------------------------------------------安装前必读---------------------------------------- 当前文档的版本为mysql-cluster- ......
注: 从MySQL从服务器的版本不能小于主服务器的版本 实验环境 Master Mysql服务器版本5.1.36,IP:192.168.128.130 Slave Mysql服务器版本5.1.36,IP:192.168.128.132 一. MySQL主服务器配置 1.建立授权用户 用法:grant replication slave on *.* to ‘用户名’@'主机’ identified by ‘密码’; mysql>grant replicatio ......