Java JDBC Statement run delete statement
import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; public class Main { public static void performDelete(Connection conn){ String sql = "DELETE FROM RECIPES WHERE RECIPE_NUM = '1'"; Statement stmt = null;/*from w w w .j ava 2s . c o m*/ try { stmt = conn.createStatement(); int result = stmt.executeUpdate(sql); if (result > 0){ System.out.println("-- Record Deleted --"); } else { System.out.println("!! Record NOT Deleted!!"); } } catch (SQLException e) { e.printStackTrace(); } finally { if (stmt != null) { try { stmt.close(); } catch (SQLException ex) { ex.printStackTrace(); } } } } }