Announcement Announcement Module
Collapse
No announcement yet.
DataAccessException for a deadlock not mapped Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DataAccessException for a deadlock not mapped

    We are catching all DataAccessExceptions and reporting the exception using ex.getMessage(). Recently we got the following exception message:

    (executing StatementCallback): encountered SQLException [JZ0BE: BatchUpdateException: Error occurred while executing batch statement: Your server command (family id #0, process id #106) encountered a deadlock situation. Please re-run your command.];

    nested exception is com.sybase.jdbc2.jdbc.SybBatchUpdateException: JZ0BE: BatchUpdateException: Error occurred while executing batch statement: Your server command (family id #0, process id #106) encountered a deadlock situation. Please re-run your command.

    This exception was thrown when executing the following code:

    jdbcTemplate.batchUpdate( sql );

    Where sql is an array of SQL statements.

    The actual Spring exception thrown was org.springframework.jdbc.UncategorizedSQLException and the stack trace was:

    at com.sybase.jdbc2.jdbc.ErrorMessage.raiseBatchUpdat eException(ErrorMessage.java:802)
    at com.sybase.jdbc2.jdbc.SybStatement.batchLoop(SybSt atement.java:1329)
    at com.sybase.jdbc2.jdbc.SybStatement.sendBatch(SybSt atement.java:1138)
    at com.sybase.jdbc2.jdbc.SybStatement.executeBatch(Sy bStatement.java:1105)
    at com.sybase.jdbc2.jdbc.SybStatement.executeBatch(Sy bStatement.java:949)
    at org.springframework.jdbc.core.JdbcTemplate$1BatchU pdateStatementCallback.doInStatement(JdbcTemplate. java:389)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:256)
    at org.springframework.jdbc.core.JdbcTemplate.batchUp date(JdbcTemplate.java:408)


    I am assuming that the correct Spring exception, if this were mapped correctly, would be DeadlockLoserDataAccessException.

    However, the Sybase mapping didn't pick it up. What is the procedure for getting an update to the mapping code to pick this up?

    Thanks,
    SZ

  • #2
    Modify a copy of sql-error-codes.xml and put in your classpath before the rest of Spring. You would need to add entry in the Sybase object to include support for the exception you are looking for. Basically you would set the DeadlockLoserCodes property with the proper SQLErrorCode values. For a complete list of property names for the objects in sql-error-codes.xml see SQLErrorCodes

    If you feel this should belong in the release version of sql-error-codes.xml (and perhaps other SQLErrorCode mappings) you could enter an issue in JIRA.

    Comment

    Working...
    X