private void testSavepoint() throws SQLException {
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");
conn.setAutoCommit(false);
stat.execute("INSERT INTO TEST VALUES(0, 'Hi')");
Savepoint savepoint1 = conn.setSavepoint();
int id1 = savepoint1.getSavepointId();
assertThrows(ErrorCode.SAVEPOINT_IS_UNNAMED, savepoint1).
getSavepointName();
stat.execute("DELETE FROM TEST");
conn.rollback(savepoint1);
stat.execute("UPDATE TEST SET NAME='Hello'");
Savepoint savepoint2a = conn.setSavepoint();
Savepoint savepoint2 = conn.setSavepoint();
conn.releaseSavepoint(savepoint2a);
assertThrows(ErrorCode.SAVEPOINT_IS_INVALID_1, savepoint2a).
getSavepointId();
int id2 = savepoint2.getSavepointId();
assertTrue(id1 != id2);
stat.execute("UPDATE TEST SET NAME='Hallo' WHERE NAME='Hello'");
Savepoint savepointTest = conn.setSavepoint("Joe's");
stat.execute("DELETE FROM TEST");
assertEquals(savepointTest.getSavepointName(), "Joe's");
assertThrows(ErrorCode.SAVEPOINT_IS_NAMED, savepointTest).
getSavepointId();
conn.rollback(savepointTest);
conn.commit();
ResultSet rs = stat.executeQuery("SELECT NAME FROM TEST");