Here you can find the source of executeStatement(Connection con, String sql)
Parameter | Description |
---|---|
con | the connection instance |
sql | the sql to be executed |
Parameter | Description |
---|---|
SQLException | if any sql error |
static void executeStatement(Connection con, String sql) throws SQLException
//package com.java2s; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class Main { /**//from ww w .j a v a2s . com * Insert data into the database. * * @param con the connection instance * @param sql the sql to be executed * * @throws SQLException if any sql error */ static void executeStatement(Connection con, String sql) throws SQLException { PreparedStatement ps = con.prepareStatement(sql); ps.executeUpdate(); } }