Java SQL Update ExecUpdateSql(Connection conn, String strSql)

Here you can find the source of ExecUpdateSql(Connection conn, String strSql)

Description

Exec Update Sql

License

Open Source License

Declaration

public static void ExecUpdateSql(Connection conn, String strSql)
            throws Exception 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.sql.Connection;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Main {
    private static final Logger logger = LogManager.getLogger();

    public static void ExecUpdateSql(Connection conn, String strSql)
            throws Exception {
        java.sql.Statement stmt = conn.createStatement();
        logger.info(strSql);//from   w  ww  . j ava  2s .  co m
        int i = stmt.executeUpdate(strSql);
        logger.info("rows count={}", i);
        if (conn.getAutoCommit() == false) {
            conn.commit();
        }
    }
}

Related

  1. execUpdateQuery(Connection C, String query)
  2. executeUpdate(Connection conn, String sql)
  3. executeUpdate(Connection conn, String sql)
  4. executeUpdate(Connection conn, String sql)
  5. executeUpdate(Connection conn, String sql)