User146378
User146378

Reputation: 225

Nested exception is com.microsoft.sqlserver.jdbc.SQLServerException:The server failed to resume the transaction

I am trying to invoke a stored procedure using java using jdbctemplate and most of the time I got the below exception .

2016-05-03 11:47:26 ERROR SomeController:60 - Error in ..getOpenItems()
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [{call storedproc1(?,?,?,?,?,?,?,?)}]; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The server failed to resume the transaction. Desc:a600000018.

at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:98)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)

Java Code :

String sql = "{call storedproc1(?,?,?,?,?,?,?,?)}";
        Object[] parameters = new Object[] {iDisplayStart,iDisplayLength,iSortCol_0,sSortDir_0,sSearch,accNr,ownNr,place};
        
List<DetailBen> invoiceAvailable = jdbcTemplate.query(sql, parameters,new  DetailMapper());

Am I doing anything wrong . It works fine in local environment but throwing the above exception in test environment .

Upvotes: 0

Views: 4146

Answers (1)

User146378
User146378

Reputation: 225

I am able to fix it . There was a sequence of stored procedure which were called in the flow and in one of the stored procedure there was a statement called "Begin Transaction" and at the end of the stored procedure there was an another statement called "Commit transaction" . I know what these statement means but I commented out these statements and It fixed .

Surprising this was . I my local its working perfectly even without the commented transaction but which was not working in UAT . So commented it now it works fine in both local and UAT . I still dont know the reason why it fixed but got fixed

Upvotes: 1

Related Questions