I have connected my DB with eclipse and i want to give the administrator the permission to delete a member putting the members id from Scanner from a table that I have created
public void processDelete() {
try {
String url = "jdbc:mysql://localhost:3306/labdb";
String user = "****";
String password = "***";
Connection myConn = null;
myStmt = null;
ResultSet myRs = null;
Scanner keyboard=new Scanner(System.in);
System.out.println("Enter the id you want to delete");
int id=keyboard.nextInt();
int rowsAffect=myStmt.executeUpdate(
"delete from members " +
"where member_id='"+id+"' ");
} catch (Exception exc) {
exc.printStackTrace();
}
and i get this error
java.lang.NullPointerException
at DeleteMembers.processDelete(DeleteMembers.java:24)
at main.main(main.java:67)