0

The following error occurs when an exception occurs for myJDBCTemplate.queryForList() , before which a setQueryTimeout(1) is set. I have a database which has 1.2 million rows, and looking for the timeout exception to be printed or occur in the case when the statement is executed. So, basically, the timeout occurs but the exception does not mention that.

I am using springFramework-version => 4.1.3.RELEASE in pom.xml

    INFO: org.springframework.beans.factory.xml.XMLBeanDefinitionReader - Loading XML bean definition for class path resource [org/springframework/jdbc/support/sql-error-code.xml]



    org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL [select * from myTable where userCategory='1']; SQL state [70100]; error code [1317]; Query execution was interrupted; nested exception is java.sql.SQLException: Query execution was interrupted
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:416)
        at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:471)
        at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:481)
……..
caused by java.sql.SQLExcepion: Query execution was interrupted.

From the answer found at Query execution was interrupted, error #1317 states, the interruption occurs because of timeout, which I think is the possible cause.

Also, the exception states it is caused by java.sql.SQLException, but there are no exact details, why it occurred? So, I am not sure is it because of timeout or something else.

Community
  • 1
  • 1
NNikN
  • 3,322
  • 5
  • 38
  • 74
  • Can u plz add full stack trace? – Bacteria Aug 23 '15 at 16:28
  • @Pitchers, Exception details are added, I am looking to print timeout exception, but there are some issue with sql-errorcodes.xml – NNikN Aug 23 '15 at 16:38
  • sorry, but I am unable to understand ur actual question.In title u mentioned **Spring sql-error-codes.xml does not load**. Is it really not loaded? I think it's loaded properly. – Bacteria Aug 23 '15 at 16:57
  • @Pitchers you are right, I have now framed the question correctly. – NNikN Aug 23 '15 at 17:14

1 Answers1

1

The error is clear in your stack trace:-

error code [1317]; Query execution was interrupted

, which means your query is being interrupted by an execution time limit. This error occurs when your query takes an unexpectedly long time to execute.

The error can be solved by fetching the data in batches by executing the query repeatedly for a certain data range.

Amit Bhati
  • 5,215
  • 1
  • 19
  • 42
  • True, it was interrupted, but no exact details on whether it occurred because of timeout. – NNikN Aug 23 '15 at 17:15