com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:Cannot delete or update a parent row: a foreign key constraint fails,jdbc删除的时候外建引用异常,如何捕捉
------解决方案--------------------
try..catch块就行了,举个栗子:
public static void main(String[] args) {
try {
DriverManager.getConnection("xxxx");
} catch (MySQLIntegrityConstraintViolationException e) {
// TODO: handle exception
} catch (SQLException e){
// TODO: handle exception
}
}