Follow by Email

Monday, October 17, 2016

org.springframework.jdbc.BadSqlGrammarException CallableStatementCallback; bad SQL grammar

I was getting below exception in my code where my query in the function was perfectly working fine in oracle but in java code giving me this error

org.springframework.jdbc.BadSqlGrammarException: CallableStatementCallback; bad SQL grammar [{call schema.package.function(?, ?, ?)}]; nested exception is java.sql.SQLException: Invalid column name

Thanks to this thread

I noticed there  was no ORA error message in the exception , which means the call was executed successfully in JDBC level , and than I had to check my mapper defined for this execution there I was trying to get  a column from resultset which was not selected in the original query hence the problem " java.sql.SQLException: Invalid column name"

I added the missing column in my query and got rid of this exception. Good Lesson Learned.

Lesson Learned : If there is no ORA error in your exception chances are that the JDBC call was ok and now something wrong in your java code .

Saturday, October 15, 2016 Broken pipe

Reason :

I was facing this exception when I was trying to create a resultset with a lot of records in it , later I found the data set was so huge that even in PL/SQL it was showing memory issues.

Solution :

I had to restrict my query to be executed for a specific date range which user may select and warn the user about any possible issues when the date is very long.