1 | |
package liquibase.database.jvm; |
2 | |
|
3 | |
import liquibase.exception.DatabaseException; |
4 | |
|
5 | |
import java.sql.Connection; |
6 | |
import java.sql.SQLException; |
7 | |
import java.sql.Statement; |
8 | |
|
9 | |
public class DerbyConnection extends JdbcConnection { |
10 | |
|
11 | |
public DerbyConnection(Connection connection) { |
12 | 0 | super(connection); |
13 | 0 | } |
14 | |
|
15 | |
@Override |
16 | |
public void commit() throws DatabaseException { |
17 | 0 | super.commit(); |
18 | |
|
19 | 0 | checkPoint(); |
20 | 0 | } |
21 | |
|
22 | |
@Override |
23 | |
public void rollback() throws DatabaseException { |
24 | 0 | super.rollback(); |
25 | |
|
26 | 0 | checkPoint(); |
27 | 0 | } |
28 | |
|
29 | |
private void checkPoint() throws DatabaseException { |
30 | 0 | Statement st = null; |
31 | |
try { |
32 | 0 | st = createStatement(); |
33 | 0 | st.execute("CALL SYSCS_UTIL.SYSCS_CHECKPOINT_DATABASE()"); |
34 | 0 | } catch (SQLException e) { |
35 | 0 | throw new DatabaseException(e); |
36 | |
} finally { |
37 | 0 | if (st != null) { |
38 | |
try { |
39 | 0 | st.close(); |
40 | 0 | } catch (SQLException e) { |
41 | |
|
42 | 0 | } |
43 | |
} |
44 | |
} |
45 | 0 | } |
46 | |
} |