Monday, 8 July 2013

org.hibernate.exception.GenericJDBCException: could not execute query

if you getting (org.hibernate.exception.GenericJDBCException) following exception :-


Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not execute query
 at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
 at org.hibernate.loader.Loader.doList(Loader.java:2216)
 at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
 at org.hibernate.loader.Loader.list(Loader.java:2099)
 at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
 at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
 at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
 at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
 at com.gwtech.crm.action.TestProcedure.main(TestProcedure.java:25)
Caused by: java.sql.SQLException: PROCEDURE fetchList can't return a result set in the given context
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
 at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
 at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
 at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
 at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
 at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
 at org.hibernate.loader.Loader.doQuery(Loader.java:674)
 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
 at org.hibernate.loader.Loader.doList(Loader.java:2213)
 ... 7 more

I am facing same problem when i am using (mysql-connector-java-3.0.16-ga-bin.jar) when i replace to ( mysql-connector-java-5.1.6.jar)
everything is working perfectly.

Google more to known reason. Hope This help you.