title: Spring batch trying to create persistant Batch Job Respository again
body: <p>This seems to be a stupid issue. I am trying to configure an Oracle10g database for Spring Batch Job Repository (Spring Batch 2.1.7), I was able to have the tables created using the script available at <em>org/springframework/batch/core/schema-oracle10g.sql</em> in core. I also set the property <em>batch.data.source.init</em> to <em>false</em>.</p>
  
  <p>On a clean database my batch program runs fine, successfully creating all the Batch tables/Sequences and populating them with the details of the batch results. However, when I run it again Spring Batch tries to create these tables again and throws "ORA-00955: name is already used by an existing object" exception. What am I doing wrong?</p>
  
  <pre><code># 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
  </code></pre>
  
  <p>Following is my context file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
  
      &lt;context:property-placeholder location="classpath:batch.properties" /&gt;
  
      &lt;context:component-scan base-package="com.myco.mypack" /&gt;
  
      &lt;jdbc:initialize-database data-source="dataSource"&gt;
          &lt;jdbc:script location="${batch.schema.script}" /&gt;
      &lt;/jdbc:initialize-database&gt;
  
      &lt;import resource="classpath:/META-INF/spring/module-context.xml" /&gt;
  
      &lt;bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"&gt;
          &lt;property name="jobRepository" ref="jobRepository"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager"  class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;   
      &lt;/bean&gt;
  
      &lt;bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"&gt;
           &lt;property name="dataSource" ref="dataSource" /&gt;
           &lt;property name="transactionManager" ref="transactionManager"/&gt;
           &lt;property name="databaseType" value="oracle" /&gt;
           &lt;property name="tablePrefix" value="BATCH_"/&gt;
           &lt;property name="isolationLevelForCreate" value="ISOLATION_DEFAULT"/&gt;
      &lt;/bean&gt;  
  
      &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
          destroy-method="close"&gt;
          &lt;property name="driverClassName" value="${batch.jdbc.driver}" /&gt;
          &lt;property name="url" value="${batch.jdbc.url}" /&gt;
          &lt;property name="username" value="${batch.jdbc.user}" /&gt;
          &lt;property name="password" value="${batch.jdbc.password}" /&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>