Just spent some time debugging my Java code to figure out why the MySQL
update statements weren't committing to the database; in fact, they were waiting to be committed and thus causing the table to appear to be locked. The problem was in the code I'd copied from a friend; it had this line in it,
conn.setAutoCommit(false);
This was put in to only commit a transaction when it was successful. Important safety tip: Either turn the
false to
true in the above code, or include
conn.commit() statement after your DML statement to the database.
No comments:
Post a Comment