在SpringBatch中使用sybase db运行作业时,出现以下异常。该架构是使用Spring Batch附带的"schema sybase.sql"创建的。
弹簧批次版本-弹簧批次核心-2.1.7
错误
2015-04-07 09:21:13138错误[org.springframework.batch.core.slaunch.support.CommandLineJobRunner]-org.springframework.dao.TransientDataAccessResourceException:PreparedStatementCallback;SQL[SELECT JOB_INSTANCE_ID,JOB_NAME fromBATCH_JOB_INSTANCE,其中JOB_NAME=?和JOB_KEY=?];JZ006:被捕IOException:java.io.IOException:JZ0TC:尝试在一对非法的类型。;嵌套异常是java.sql.SQLException:JZ006:捕获IOException:java.io.IOException:JZ0TC:已尝试非法类型对之间的转换。
作业配置
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns ="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch-2.1.xsd">
<beans:import resource="../launch-context.xml"/>
<beans:bean id="helloWorld" class="com.chatar.batch.practice.HelloWorld"
scope="step">
<beans:property name="name" value="#{jobParameters[name]}"/>
</beans:bean>
<step id="helloWorldStep">
<tasklet ref="helloWorld"/>
</step>
<job id="helloWorldJob" incrementer="idIncrementer">
<step id="helloWorldStep1" parent="helloWorldStep"/>
<listeners>
<listener ref="loggingListener"/>
</listeners>
</job>
<beans:bean id="loggingListener" class="com.chatar.batch.practice.listener.JobLoggerListener"/>
<beans:bean id="idIncrementer" class="org.springframework.batch.core.launch.support.RunIdIncrementer"/>
</beans:beans>
在将JDBC驱动程序升级到7.0.7版本后,它与BIGINT一起工作得很好-jconn-7.0.7.jar
实际上,在schema-ybase.sql.中将BIGINT更改为INTEGER后,它工作得很好
看起来像是sybase和JDBC驱动程序兼容性的一些问题。
上面的解决方案是用jconn-3.0.jar 测试的