1

Is it possible to use sqlMapClient.startTransaction(); and sqlMapClient.commitTransaction(); in the case of Select statements?

I have given start and commit transaction for insert , update and select statement and somewhere I am getting an error.

MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:

All connection started and closed. and given for each start transactions. Nothing has added in catch block.

 finally {
     sqlMapClient.endTransaction();
 }

I guess there is no need of using start /commit transaction for select statements. Can anyone please clarify it?

Community
  • 1
  • 1
Sreevidya Aravind
  • 433
  • 1
  • 6
  • 18
  • from the error message, it seems a commit/rollback transaction happens before the select, or another implicit connection close happened. – user1484819 Jun 23 '15 at 06:47

1 Answers1

0

The error just indicates that the connection already closed, you may missed some exception/errors.

To answer your question, select of course can be in a transaction.

user1484819
  • 899
  • 1
  • 7
  • 18