您的当前位置:首页正文

org.quartz.JobPersistenceException

2020-11-09 来源:易榕旅网

运行quartz在MS SQL是出现异常,异常代码如下: org . quartz . JobPersistenceException : Couldn 't acquire next trigger: Couldn' t retrieve trigger : [ Microsoft ] [ SQLServer 2000 Driver for JDBC ] ResultSet can not re - read row data for co

运行quartz在MS SQL是出现异常,异常代码如下:

org.quartz.JobPersistenceException: Couldn't acquire next trigger: Couldn't retrieve trigger: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 9. [See nested exception: org.quartz.JobPersistenceException: Couldn't retrieve trigger: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 9. [See nested exception: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 9.]]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2741)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$35.execute(JobStoreSupport.java:2699)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3711)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2695)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:266)
Caused by: org.quartz.JobPersistenceException: Couldn't retrieve trigger: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 9. [See nested exception: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 9.]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1549)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1525)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2728)
... 4 more
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 9.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.validateColumnIndex(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getInt(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getInt(Unknown Source)
at org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:236)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java:2129)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1531)
... 6 more

分析:使用SQLServer 数据库时,可能发生此异常,原因是微软自己的jdbc驱动不支持同一个记录的字段的重复读取,因为微软加入了text,image这种类型的支持,就限制了字段的回读功能.原因是如果该表存在TEXT, NTEXT, IMAGE等大型字段,对于ResultSet的字段读取必须按照从左向右读,如果你用:

int a = rs.getInt(2);
int b = rs.getInt(1);

则报错。Microsoft给出的方案是不能从右往左也不能连续读2次。

解决方法:这个是微软JDBC驱动的一个bug,我们也可以不用他的驱动,自己到网上下载jtds.jar驱动,使用这种驱动就不会出现上面的异常了.

显示全文