提交 49612f09 authored 作者: Thomas Mueller's avatar Thomas Mueller

Test.

上级 9b098913
...@@ -12,6 +12,7 @@ import java.sql.SQLException; ...@@ -12,6 +12,7 @@ import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.Properties; import java.util.Properties;
import org.h2.Driver;
import org.h2.api.DatabaseEventListener; import org.h2.api.DatabaseEventListener;
import org.h2.test.TestBase; import org.h2.test.TestBase;
...@@ -54,7 +55,12 @@ public class TestDatabaseEventListener extends TestBase implements DatabaseEvent ...@@ -54,7 +55,12 @@ public class TestDatabaseEventListener extends TestBase implements DatabaseEvent
public void opened() { public void opened() {
try { try {
Connection conn = DriverManager.getConnection(databaseUrl, "sa", "sa"); // using DriverManager.getConnection could result in a deadlock
// when using the server mode, but within the same process
Properties prop = new Properties();
prop.setProperty("user", "sa");
prop.setProperty("password", "sa");
Connection conn = Driver.load().connect(databaseUrl, prop);
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table if not exists test(id int)"); stat.execute("create table if not exists test(id int)");
conn.close(); conn.close();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论