Java SQL Update executeUpdate(final Connection conn, final String query)

Here you can find the source of executeUpdate(final Connection conn, final String query)

Description

execute Update

License

Open Source License

Parameter

Parameter Description
connection a parameter
query a parameter

Declaration

public static void executeUpdate(final Connection conn, final String query) throws SQLException 

Method Source Code

//package com.java2s;
/*//from w  ww.  j  a  va 2s  . c om
 * Copyright (C) 2012 Openismus GmbH
 * Copyright (C) 2015 Murray Cumming
 *
 * This file is part of swing-glom
 *
 * swing-glom is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * swing-glom is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with swing-glom.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.sql.*;

public class Main {
    /**
     * @param connection
     * @param query
     */
    public static void executeUpdate(final Connection conn, final String query) throws SQLException {
        conn.setAutoCommit(false);
        final Statement st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        st.executeUpdate(query);
    }
}

Related

  1. executeUpdate(Connection conn, String sql)
  2. executeUpdate(Connection conn, String sql, Object... parameters)
  3. executeUpdate(Connection connection, String query)
  4. executeUpdate(Connection connection, String statement)
  5. executeUpdate(Connection dbConnection, String query)
  6. executeUpdate(final Connection conn, final String sqlStatmeent)
  7. executeUpdate(List paramList, Connection conn, PreparedStatement pstmt)
  8. executeUpdate(PreparedStatement preparedStatement, List paramList)
  9. executeUpdate(PreparedStatement ps)

  10. HOME | Copyright © www.java2s.com 2016