// To delete records from tables we create an SQL delete command.
// The question mark that we used in the where clause will be the
// holder of value that will be assigned by PreparedStatement class
String query = “DELETE FROM “+getTable()+” WHERE “+colName+” = ?”;

// Create a statement object. We use PreparedStatement here.

try {
PreparedStatement stmt = conn.prepareStatement(query);

// Pass a value of a the variable that will tell the database which
// records in the database to be deleted. Remember that when
// using a statement object the index parameter is start from
// 1 not 0 as in the Java array data type index
stmt.setString(1,value);

// Tell the statement to execute the command. The executeUpdate()
// method for a delete command returns number of records deleted
// as the command executed in the database. If no records was
// deleted it will simply return 0
int rows = stmt.executeUpdate();