Java Utililty Methods SQL Update

List of utility methods to do SQL Update

Description

The list of methods to do SQL Update are organized into topic(s).

Method

voidexecUpdateQuery(Connection C, String query)
exec Update Query
Statement S;
try {
    S = C.createStatement();
    S.executeUpdate(query);
    S.close();
catch (SQLException E) {
    System.out.println("SQLException: " + E.getMessage());
...
voidExecUpdateSql(Connection conn, String strSql)
Exec Update Sql
java.sql.Statement stmt = conn.createStatement();
logger.info(strSql);
int i = stmt.executeUpdate(strSql);
logger.info("rows count={}", i);
if (conn.getAutoCommit() == false) {
    conn.commit();
intexecuteUpdate(Connection conn, String sql)
execute Update
int num = 0;
try {
    Statement stmt = conn.createStatement();
    num = stmt.executeUpdate(sql);
} catch (Exception e) {
    e.printStackTrace();
return num;
...
booleanexecuteUpdate(Connection conn, String sql)
execute Update
Statement stmt = null;
try {
    stmt = conn.createStatement();
    stmt.executeUpdate(sql);
} catch (Exception e) {
    throw e;
} finally {
    close(stmt);
...
booleanexecuteUpdate(Connection conn, String sql)
execute Update
Statement stmt = null;
try {
    stmt = conn.createStatement();
    stmt.executeUpdate(sql);
} finally {
    close(stmt);
return true;
...
booleanexecuteUpdate(Connection conn, String sql)
execute Update
System.out.println("Update SQL: " + sql);
Statement stmt = null;
try {
    stmt = conn.createStatement();
    stmt.executeUpdate(sql);
} catch (Exception e) {
    throw e;
} finally {
...
intexecuteUpdate(Connection conn, String sql, Object... parameters)
execute Update
PreparedStatement stmt = null;
int result = -1;
try {
    stmt = conn.prepareStatement(sql);
    bindParams(stmt, parameters);
    result = stmt.executeUpdate();
} finally {
    if (stmt != null) {
...
intexecuteUpdate(Connection connection, String query)
execute Update
Statement stmt = null;
try {
    stmt = connection.createStatement();
    return stmt.executeUpdate(query);
} finally {
    if (stmt != null)
        try {
            stmt.close();
...
voidexecuteUpdate(Connection connection, String statement)
execute Update
Statement stmt = null;
try {
    stmt = connection.createStatement();
    stmt.executeUpdate(statement);
} finally {
    close(stmt);
intexecuteUpdate(Connection dbConnection, String query)
Executes an update query.
Statement statement = dbConnection.createStatement();
int updated = statement.executeUpdate(query);
statement.close();
return updated;