import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
public class Main {
public static void main(String[] args) throws Exception {
Connection conn = getConnection();
DatabaseMetaData dbMd = conn.getMetaData();
if (dbMd.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_COMMITTED)) {
System.out.println("Transaction Isolation level "
+ "TRANSACTION_READ_COMMITTED is supported.");
conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
}
conn.close();
}
private static Connection getConnection() throws Exception {
Class.forName("org.hsqldb.jdbcDriver");
String url = "jdbc:hsqldb:mem:data/tutorial";
return DriverManager.getConnection(url, "sa", "");
}
}
|