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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
synchronizedblock in Java — JVM doesn’t throw an exception when thread tries to entersynchronizedblock which is occupied by another thread already.The only situations when exception can be thrown here are: