I have connected Java to SQL and want to delete two rows from different tables, but having issues with my Java Method. I am trying to delete from both tables because I can't delete ID from Table1 because it is referenced by table2. Any suggestions on fixing this?
public void delete() throws SQLException
{
DataConnection connection = new DataConnection();
String query = " DELETE FROM " + Table1 + " WHERE ID = " + id + " AND " + " DELETE FROM " + Table2 + " WHERE ID = " + id;
connection.updateData(query);
connection.closeConnection();
}