提交 dbb83a90 authored 作者: Thomas Mueller's avatar Thomas Mueller

Close all connections.

上级 97a79050
......@@ -325,7 +325,7 @@ public class TestLob extends TestBase {
trace("shutdown immediately");
conn.createStatement().execute("SHUTDOWN IMMEDIATELY");
trace("shutdown done");
conn = reconnect(null);
conn = reconnect(conn);
conn.setAutoCommit(false);
sp = null;
}
......@@ -355,7 +355,7 @@ public class TestLob extends TestBase {
conn.createStatement().execute("DELETE FROM TEST");
conn.createStatement().execute("CHECKPOINT");
conn.createStatement().execute("SHUTDOWN IMMEDIATELY");
conn = reconnect(null);
conn = reconnect(conn);
ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM TEST");
assertTrue(rs.next());
rs.getInt(1);
......@@ -403,8 +403,7 @@ public class TestLob extends TestBase {
Statement stat0 = conn0.createStatement();
stat0.executeUpdate("drop table CLOB_ENTITY if exists");
stat0.getWarnings();
stat0
.executeUpdate("create table CLOB_ENTITY (ID bigint not null, DATA clob, CLOB_DATA clob, primary key (ID))");
stat0.executeUpdate("create table CLOB_ENTITY (ID bigint not null, DATA clob, CLOB_DATA clob, primary key (ID))");
stat0.getWarnings();
stat0.close();
conn0.getWarnings();
......@@ -651,7 +650,11 @@ public class TestLob extends TestBase {
private Connection reconnect(Connection conn) throws SQLException {
long time = System.currentTimeMillis();
if (conn != null) {
conn.close();
try {
conn.close();
} catch (SQLException e) {
// ignore
}
}
conn = getConnection("lob");
trace("re-connect=" + (System.currentTimeMillis() - time));
......
......@@ -51,8 +51,17 @@ public class TestOutOfMemory extends TestBase {
fail();
} catch (SQLException e) {
assertEquals(ErrorCode.OUT_OF_MEMORY, e.getErrorCode());
try {
conn.close();
fail();
} catch (SQLException e2) {
assertEquals(ErrorCode.DATABASE_IS_CLOSED, e2.getErrorCode());
}
}
freeMemory();
conn = null;
conn = getConnection("outOfMemory");
stat = conn.createStatement();
ResultSet rs = stat.executeQuery("select count(*) from stuff");
rs.next();
assertEquals(3000, rs.getInt(1));
......
......@@ -189,6 +189,11 @@ public class TestPowerOff extends TestBase {
}
assertTrue(deleted);
}
try {
conn.close();
} catch (SQLException e) {
// ignore
}
conn = getConnection(url);
conn.close();
}
......@@ -215,6 +220,11 @@ public class TestPowerOff extends TestBase {
}
((JdbcConnection) conn).setPowerOffCount(0);
try {
conn.close();
} catch (SQLException e) {
// ignore
}
conn = getConnection(url);
stat = conn.createStatement();
ResultSet rs = stat.executeQuery("SELECT COUNT(*) FROM TEST");
......@@ -290,7 +300,7 @@ public class TestPowerOff extends TestBase {
}
conn.close();
} catch (SQLException e) {
if (e.getSQLState().equals("" + ErrorCode.SIMULATED_POWER_OFF)) {
if (e.getSQLState().equals("" + ErrorCode.DATABASE_IS_CLOSED)) {
// this is ok
} else {
throw e;
......
......@@ -40,6 +40,8 @@ public class AliasMapTest extends TestBase {
.orderBy(p.productId).select();
assertEquals("[]", products.toString());
db.close();
}
}
......@@ -50,6 +50,7 @@ public class TestConnectionPool extends TestBase {
Connection conn2 = man.getConnection();
assertTrue(conn2.getAutoCommit());
conn2.close();
man.dispose();
}
......
......@@ -76,6 +76,7 @@ public class TestXA extends TestBase {
Connection c = xa.getConnection();
assertTrue(!c.getAutoCommit());
c.close();
xa.close();
}
private void testXA(boolean useOneDatabase) {
......
......@@ -213,6 +213,12 @@ public class TestFileLockSerialized extends TestBase {
printResult(stat2, "select * from test");
conn2.close();
try {
conn.close();
} catch (SQLException e) {
// ignore
}
}
private void testConcurrentReadWrite() throws Exception {
......
......@@ -518,6 +518,11 @@ public class TestTools extends TestBase {
} catch (SQLException e) {
assertKnownException(e);
}
try {
conn.close();
} catch (SQLException e) {
// ignore
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论