Here you can find the source of executeUpdate(Connection conn, String sql)
public static boolean executeUpdate(Connection conn, String sql) throws Exception
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { public static boolean executeUpdate(Connection conn, String sql) throws Exception { Statement stmt = null;// w ww .j a va 2s. co m try { stmt = conn.createStatement(); stmt.executeUpdate(sql); } catch (Exception e) { throw e; } finally { close(stmt); } return true; } public static void close(Connection conn) { if (null != conn) { try { conn.close(); conn = null; } catch (SQLException e) { } } } public static void close(Statement stmt) { if (null != stmt) { try { stmt.close(); stmt = null; } catch (SQLException e) { } } } public static void close(ResultSet rs, Statement stmt) { if (null != rs) { try { rs.close(); rs = null; } catch (SQLException e) { } } if (null != stmt) { try { stmt.close(); stmt = null; } catch (SQLException e) { } } } }