Skip to content

Commit

Permalink
SYMMETRICDS-296 - Put cursor in non auto commit mode before extractin…
Browse files Browse the repository at this point in the history
…g result set. This is required by postgres.
  • Loading branch information
chenson42 committed Jul 12, 2010
1 parent 30ee210 commit 2b2b511
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -262,9 +262,14 @@ public Object doInConnection(Connection conn) throws SQLException, DataAccessExc
: new NodeChannel(triggerRouter.getTrigger().getChannelId());
Set<Node> oneNodeSet = new HashSet<Node>();
oneNodeSet.add(node);

boolean autoCommitFlag = conn.getAutoCommit();
PreparedStatement st = null;
ResultSet rs = null;
try {

conn.setAutoCommit(false);

st = conn.prepareStatement(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY,
java.sql.ResultSet.CONCUR_READ_ONLY);
st.setQueryTimeout(jdbcTemplate.getQueryTimeout());
Expand Down Expand Up @@ -297,6 +302,7 @@ public Object doInConnection(Connection conn) throws SQLException, DataAccessExc
dataExtractor.commit(batch, writer);
}
} finally {
conn.setAutoCommit(autoCommitFlag);
JdbcUtils.closeResultSet(rs);
JdbcUtils.closeStatement(st);
}
Expand Down

0 comments on commit 2b2b511

Please sign in to comment.