日期:2014-05-16 浏览次数:20465 次
数据库事务?2009-07-04 15:22:53?阅读111?评论0??字号:大中小?订阅 public static void main(String[] args) { ?String url = "jdbc:jtds:sqlserver://localhost:1433;DatabaseName=zypsb";jdbc查看数据库事务隔离级别
?String driverClass = "net.sourceforge.jtds.jdbc.Driver";
?// driverClass = "com.mysql.jdbc.Driver";
?driverClass = "oracle.jdbc.driver.OracleDriver";
?// url =
?// "jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=gb2312";
?url = "jdbc:oracle:thin:@localhost:1521:SUNJUN";
?try {
??Class.forName(driverClass);
??Connection con = DriverManager.getConnection(url, "system",
????"sunjun");
??DatabaseMetaData dbmt = con.getMetaData();
??System.out.println(dbmt.supportsTransactions());
??// 0
??if (dbmt
????.supportsTransactionIsolationLevel(Connection.TRANSACTION_NONE))
???System.out.println("TRANSACTION_NONE");
??// 1
??if (dbmt
????.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED))
???System.out.println("TRANSACTION_READ_UNCOMMITTED");
??// 2