Reputation: 8787
Simple question, but.. just want to be sure. If database connection is set to conn.setAutoCommit(false);
, after st.executeQuery(...);
- do we need to conn.commit();
? Of course, if some changes were made like st.execute(...);
- conn.commit();
is needed. I'm using HSQLDB
.
Upvotes: 4
Views: 1614
Reputation: 393866
In addition to committing updates, commit
also releases locks, so it is useful to call commit
after executing queries even if no updates were made (though this may be true only for specific databases, and you didn't specify which DB you are using).
Upvotes: 5