Announcement Announcement Module
Collapse
No announcement yet.
How to stop Database initialisation on server restart Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to stop Database initialisation on server restart

    Hi mates
    I am using Spring Batch Admin 1.2.1. Whenever I restart my server, it clear the database. How can I stop this database initializtion

    Please help

    Thanks

  • #2
    What do you mean? By default it uses a in memory DB..that's why it gets wiped out. You have to map it to a persistant store then only you will be able to retain values.

    Comment


    • #3
      I have already Mapped it to persistant store(Orcale). I run my job, it stores that data in orcale. The data is persistant if I shutdown my server(Tomcat) but when I start it again, my application wipes out previous data. Following is my batch-orcale.properties
      batch.jdbc.driver=oracle.jdbc.OracleDriver
      batch.jdbc.url=jdbc:oracle:thin:@//localhost:1521/XE
      batch.jdbc.user=test
      batch.jdbc.password=test
      batch.schema=
      batch.jndi.name=
      batch.naming.factory.initial=
      batch.naming.provider.url=

      batch.data.source.init=false
      batch.schema.script=classpath:/org/springframework/batch/core/schema-oracle10g.sql
      batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-oracle10g.sql

      and I have following config in /META-INF/spring/batch/override/data-source-context.xml

      <jdbc:initialize-database data-source="dataSource" enabled="${batch.data.source.init}" ignore-failures="DROPS">
      <jdbc:script location="${batch.drop.script}"/>
      <jdbc:script location="${batch.schema.script}"/>
      <jdbc:script location="${batch.business.schema.script}"/>
      </jdbc:initialize-database>

      but it doesnot seem working. What am I missing ?

      Comment


      • #4
        I think what is happening is that when you server starts up it is dropping all tables and re-creating them. I use the apache basic db pool and it works perfectly in oracle


        Code:
        
        <bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean" >
        		<property name="databaseType" value="oracle" />
        		<property name="dataSource" ref="dataSource" />
        		<property name="transactionManager" ref="transactionManager" /> 
        	</bean>
        
        
        
        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> 
        			<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
        			<property name="url" value="jdbc:oracle:thin:@"/>
        			<property name="username" value="" />
        			<property name="password" value="" />
        	</bean>
            		
        	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
        			p:dataSource-ref="dataSource"/>

        Comment


        • #5
          Originally posted by sambaran View Post
          I think what is happening is that when you server starts up it is dropping all tables and re-creating them. I use the apache basic db pool and it works perfectly in oracle


          Code:
          
          <bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean" >
          		<property name="databaseType" value="oracle" />
          		<property name="dataSource" ref="dataSource" />
          		<property name="transactionManager" ref="transactionManager" /> 
          	</bean>
          
          
          
          <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> 
          			<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
          			<property name="url" value="jdbc:oracle:thin:@"/>
          			<property name="username" value="" />
          			<property name="password" value="" />
          	</bean>
              		
          	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
          			p:dataSource-ref="dataSource"/>
          I am also using the same configurations. How I can stop Batch Admin application from droping/recreating all of my table?

          Comment

          Working...
          X