import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; public class App { public static void deleteEmployee(int id) { Connection conn = null; try { String url = "jdbc:mariadb://localhost:3306/surubt"; conn = DriverManager.getConnection(url, "surubt", "titok"); String sql = "delete from employees where id=?"; PreparedStatement pstmt = conn.prepareStatement(sql); pstmt.setInt(1, id); pstmt.execute(); }catch(SQLException ex) { System.err.println("Hiba! Az SQL művelet sikertelen!"); System.err.println(ex.getMessage()); } } public static void main(String[] args) throws Exception { System.out.println("Törlés"); deleteEmployee(7); } }