Here you can find the source of execute(Connection connection, String sql)
public static boolean execute(Connection connection, String sql) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.*; public class Main { /**/* w ww. j a v a 2s . co m*/ * Executes provided sql string */ public static boolean execute(Connection connection, String sql) throws SQLException { PreparedStatement statement = null; try { statement = connection.prepareStatement(sql); return statement.execute(); } finally { closeQuietly(statement); } } /** * Closes provided {@link ResultSet} without throwing exception * * @param rs {@link ResultSet} to close */ public static void closeQuietly(ResultSet rs) { if (rs != null) { try { rs.close(); } catch (Exception e) { //ignore } } } /** * Closes provided {@link Statement} without throwing exception * * @param statement {@link Statement} to close */ public static void closeQuietly(Statement statement) { if (statement != null) { try { statement.close(); } catch (Exception e) { //ignore } } } /** * Closes provided {@link Connection} without throwing exception * * @param connection {@link Connection} to close */ public static void closeQuietly(Connection connection) { if (connection != null) { try { connection.close(); } catch (Exception e) { //ignore } } } }