List of utility methods to do SQL Update
void | executeUpdate(final Connection conn, final String query) execute Update conn.setAutoCommit(false);
final Statement st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
st.executeUpdate(query);
|
void | executeUpdate(final Connection conn, final String sqlStatmeent) Executes a jdbc update statement and disposes of the resources PreparedStatement ps = null; try { ps = conn.prepareStatement(sqlStatmeent); ps.executeUpdate(); } finally { close(new Object[] { ps }); |
int | executeUpdate(List Don't forget We need to use this way to close pstmt and connection in persistence layer. int returnCode = -100; try { Iterator<String> paramIter = paramList.iterator(); int i = 1; while (paramIter.hasNext()) { String eachParam = (String) paramIter.next(); pstmt.setString(i, eachParam); i++; ... |
boolean | executeUpdate(PreparedStatement preparedStatement, List Generic update function. try { int i = 1; for (Object param : paramList) { if (param instanceof String) { preparedStatement.setString(i, String.valueOf(param)); i++; preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); return false; return true; |
int | executeUpdate(PreparedStatement ps) execute Update assert locked : "Database isn't locked"; int i = ps.executeUpdate(); return i; |
int | executeUpdate(String parameterizedSQL, List execute Update PreparedStatement pstmt = null; try { pstmt = prepareStatement(parameterizedSQL, values, conn); return pstmt.executeUpdate(); } finally { try { if (pstmt != null) pstmt.close(); ... |
int | executeUpdate(String queryStatement, Connection database) execute Update return database.createStatement().executeUpdate(queryStatement);
|
int | ExecuteUpdate(String sql, List Execute Update int iRet = 0; try { GetConnection(); PreparedStatement stm = dbConnection.prepareStatement(sql); if (stm != null) { for (int i = 0; i < paras.size(); i++) { stm.setString(i + 1, paras.get(0)); iRet = stm.executeUpdate(sql); } catch (Exception e) { e.printStackTrace(); } finally { EndConnection(); return iRet; |
int | executeUpdateNoCommit(Connection c, String query) executeUpdateNoCommit int rowsUpdated = -1; Statement st = c.createStatement(); try { rowsUpdated = st.executeUpdate(query); } catch (SQLException ee) { throw ee; } finally { try { ... |
int | executeUpdatePreparedStm(Connection conn, String preparedStm, Object... sqlParameters) execute prepared sql statment int rs = 0; PreparedStatement prepStm = null; if (conn != null) { prepStm = conn.prepareStatement(preparedStm); if (sqlParameters != null) { for (int i = 1; i <= sqlParameters.length; i++) { prepStm.setObject(i, sqlParameters[i - 1]); rs = prepStm.executeUpdate(); return rs; |