execute Update - Java java.sql

Java examples for java.sql:Statement

Description

execute Update

Demo Code


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Main{
    public static void executeUpdate(Statement stmt, String sql) {
        try {// w  w w.  j  a v  a2s.  c  o  m
            if (stmt != null) {
                stmt.executeUpdate(sql);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}

Related Tutorials