Here you can find the source of runQuery(Connection con, String query)
Parameter | Description |
---|---|
query | custom query |
Parameter | Description |
---|---|
SQLException | throws an exception if an error occurs |
public static int runQuery(Connection con, String query) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class Main { /**/*from ww w . j a va2s .com*/ * to run an update query such as update, delete * * @param query * custom query * @throws SQLException * throws an exception if an error occurs */ public static int runQuery(Connection con, String query) throws SQLException { PreparedStatement st = con.prepareStatement(query); return st.executeUpdate(); } }