Điều này có vẻ là một vấn đề ngu ngốc. Tôi đang cố gắng cấu hình một cơ sở dữ liệu Oracle10g cho kho lưu trữ công việc Spring Batch (Spring Batch 2.1.7), tôi có thể tạo các bảng được tạo bằng cách sử dụng tập lệnh có sẵn tại org/springframework/batch/core/schema-oracle10g.sql cốt lõi. Tôi cũng đặt thuộc tính batch.data.source.init thành false.Hàng loạt mùa xuân cố gắng tạo lại việc lặp lại công việc hàng loạt một lần nữa
Trên cơ sở dữ liệu sạch, chương trình theo lô của tôi chạy tốt, tạo thành công tất cả các bảng/chuỗi lô và điền chúng với các chi tiết của kết quả lô. Tuy nhiên, khi tôi chạy lại nó, Spring Batch cố gắng tạo lại các bảng này và ném "ORA-00955: tên đã được sử dụng bởi một đối tượng hiện có" ngoại lệ. Tôi đang làm gì sai?
# For Oracle
batch.jdbc.driver=oracle.jdbc.driver.OracleDriver
batch.jdbc.url=jdbc:oracle:thin:@localhost:1521:orcl
batch.jdbc.user=****
batch.jdbc.password=****
batch.schema=****
batch.schema.script=classpath:/org/springframework/batch/core/schema-oracle10g.sql
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-oracle10g.sql
batch.jdbc.testWhileIdle=true
batch.data.source.init=false
Sau đây là tập tin bối cảnh của tôi:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:property-placeholder location="classpath:batch.properties" />
<context:component-scan base-package="com.myco.mypack" />
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="${batch.schema.script}" />
</jdbc:initialize-database>
<import resource="classpath:/META-INF/spring/module-context.xml" />
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository"/>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager"/>
<property name="databaseType" value="oracle" />
<property name="tablePrefix" value="BATCH_"/>
<property name="isolationLevelForCreate" value="ISOLATION_DEFAULT"/>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${batch.jdbc.driver}" />
<property name="url" value="${batch.jdbc.url}" />
<property name="username" value="${batch.jdbc.user}" />
<property name="password" value="${batch.jdbc.password}" />
</bean>
</beans>
hãy thêm cấu hình xml nơi bạn sử dụng trình giữ chỗ –
Xin chào Michael, đã chỉnh sửa câu hỏi của tôi để thêm cấu hình XML. – dchucks