In this article, you have learned how to minimize the occurrence of locks and how to handle situations in your code when your database returns error codes that constitute deadlocks and timeouts. And finally, whenever -911, -904, or -912 occur, the application waits for RETRY_WAIT_TIME before the next retry is executed. Furthermore, when a “maximum locks” (-911) situation occurs, the application does not need to roll back manually because the rollback occurs automatically. + e.getSQLState() + " Message : " + e.getMessage()) Īs you can see from the above example, the application will retry deadlocks, maximum locks, and timeouts MAX_RETRY_ATTEMPTS times. out.println( "Error has occured - Error Code: " do not retry if we get any other error out.println( "Sleep was interrupted." + e1) we still want to retry, even though sleep was The following is a sample Java code to catch and retry -911, -912, and -904 SQL Return Codes: for ( int i = 0 i + e) The application code can submit or rollback changes and executes retry logic.
0 Comments
Leave a Reply. |