请问:数据库抛出异常问题是与数据库性能配置有关还是程序问题?
我用hibernate来实现为持久化。可是在开发过程中,遇到了一个问题。在执行一个查询语句时出现了问题:有时候能正常通过。我认为既然有时候程序能执行说明程序应该是没有问题的,是不是数据库没有作配置好呢?还是其他方面的原因。请高手指点一下我该如何解决这个问题。非常感谢!
hql语句为:
select ob.countyAreaCode,count(*)
from EncourageSupportObject as ob,ESFlowInfo as fi
where ob.countyAreaCode =:areaID
and fi.encourageSupportObject.id=ob.id
and fi.startReasonCode=:startReasonCode
and fi.nowStatusCode in (:saved_noSubmittedCode,:submitted_noConfirmedCode,:confirmedCode)
and fi.opTime>=:yearStartDate and fi.opTime<:endDate
and ob.birthYearMonth>=:birthYearMonthBegin
and ob.birthYearMonth<=:birthYearMonthEnd
group by ob.townAreaCode
抛出的异常为:
javax.servlet.ServletException: Hibernate operation: could not execute query; uncategorized SQLException for
SQL [select encourages0_.resideAreaCode as col_0_0_, count(*) as col_1_0_
from table_EncourageSupportObject encourages0_, table_ESFlowInfo esflowinfo1_
where encourages0_.townAreaCode=?
and esflowinfo1_.encourageSupportObject=encourages0_.id
and esflowinfo1_.startReasonCode=?
and (esflowinfo1_.nowStatusCode in (? , ? , ?))
and esflowinfo1_.opTime>=?
and esflowinfo1_.opTime<?
and encourages0_.birthYearMonth>=?
and encourages0_.birthYearMonth<=?
group by encourages0_.resideAreaCode];
SQL state [24501]; error code [-501]; [IBM][CLI Driver][DB2/NT] SQL0501N 在 FETCH 或 CLOSE 语句中指定的游标未打开。 SQLSTATE=24501;
nested exception is COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0501N 在 FETCH 或 CLOSE 语句中指定的游标未打开。 SQLSTATE=24501