I want to use JDBC to access a MySQL database. What or will an SQLException be thrown if I happen to select a row that is previously locked by a "SELECT ... FOR UPDATE" statement.
Thank you.
I believe, no exception will be thrown, calling Java thread just will be blocked until RDBMS releases locked data. It's normal situation, so need to throw an exception. Think of it as an analog of synchronized
block in Java -- JVM doesn't throw an exception when thread tries to enter synchronized
block which is occupied by another thread already.
The only situations when exception can be thrown here are:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.