Java SQL Execute executeSQLCommand(Connection conn, String sql, byte[] blob)

Here you can find the source of executeSQLCommand(Connection conn, String sql, byte[] blob)

Description

execute SQL Command

License

LGPL

Declaration

public static void executeSQLCommand(Connection conn, String sql, byte[] blob) throws SQLException 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.sql.*;

public class Main {
    public static void executeSQLCommand(Connection conn, String sql, byte[] blob) throws SQLException {
        PreparedStatement st = null;
        conn.setAutoCommit(true);//  w  w  w. ja  v a 2s .  c  om
        try {
            st = conn.prepareStatement(sql);
            st.setBytes(1, blob);
            st.executeUpdate();
        } finally {
            if (st != null)
                st.close();
        }
    }

    public static void executeSQLCommand(Connection conn, String sql) throws SQLException {
        Statement st = null;
        conn.setAutoCommit(true);
        try {
            st = conn.createStatement();
            st.executeUpdate(sql);
        } finally {
            if (st != null)
                st.close();
        }
    }
}

Related

  1. executeSQL(Connection conn, String sql)
  2. executeSql(Connection conn, String sql)
  3. executeSQL(Connection connection, String file)
  4. executeSQL(Connection session, String sql, Object... params)
  5. executeSqlAutoCommit(Connection connection, String sql)
  6. executeSQLCommandWithResult(Connection conn, String sql)
  7. executeSqlFile(Connection connection, String sqlPath)
  8. executeSqlFile(String filename, Connection connection)
  9. executeSqlFromSql(Connection connection, String sql, String name)