Spring Batch - Sybase尝试在非法类型对之间进行转换

时间:2015-04-07 04:05:22

标签: spring-batch

我在使用sybase db在SpringBatch中运行作业时遇到异常。该模式是使用Spring Batch附带的“schema-sybase.sql”创建的。

Spring-batch 版本 - spring-batch-core-2.1.7

错误

  

2015-04-07 09:21:13,138错误   [org.springframework.batch.core.launch.support.CommandLineJobRunner] -      org.springframework.dao.TransientDataAccessResourceException:   PreparedStatementCallback; SQL [SELECT JOB_INSTANCE_ID,来自的JOB_NAME   BATCH_JOB_INSTANCE JOB_NAME =?和JOB_KEY =?]; JZ006:抓住了   IOException:java.io.IOException:JZ0TC:尝试之间的转换   一对非法的。嵌套异常是java.sql.SQLException:   JZ006:Caught IOException:java.io.IOException:JZ0TC:Attempted   在一对非法类型之间进行转换。

作业配置

<?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>

2 个答案:

答案 0 :(得分:0)

实际上,在schema-sybase.sql中将BIGINT更改为INTEGER后,它工作正常。

看起来与sybase和JDBC驱动程序兼容性存在一些问题。

使用jconn-3.0.0.jar

测试上述解决方案

答案 1 :(得分:0)

将JDBC驱动程序升级到7.0.7版后,它在BIGINT上运行良好 - 的 jconn-7.0.7.jar