Results 1 to 2 of 2

Thread: 2 datasource in one JdbcCursorItemReader?

  1. #1
    Join Date
    Apr 2009
    Posts
    6

    Default 2 datasource in one JdbcCursorItemReader?

    Hello,

    I must to pull data from 2 datasource (2 Mysql DB) and then perform some business modification on this...

    For now, I just configured one datasource and all works fine...

    Here is my configuration :

    Code:
    	<job id="job1" >
    		<step id="step1">
    			<tasklet>
    				<chunk reader="itemReader" processor="bewebProcessor" writer="itemWriter" commit-interval="1"> </chunk>	
    			</tasklet>
    		</step>	
    		<listeners>
    			<listener class="com.beweb.batch.quartz.SampleListener"/>
    		</listeners>
    	</job>
    
    
    	<beans:bean id="itemReader" class="org.springframework.batch.item.database.JdbcCursorItemReader">
    	
    		<beans:property name="dataSource" ref="dataSource_beweb" />
    		<beans:property name="rowMapper">
    			<beans:bean class="com.beweb.batch.quartz.domain.internal.PersonneMapper" />
    		</beans:property>
    		<beans:property name="sql">
    			<beans:value>
    				SELECT personne.personne_id, personne.last_name, personne.first_name,
    				personne.pos, personne.year_of_birth, personne.year_drafted
    				from personne
    			</beans:value>
    		</beans:property>
    	</beans:bean>
    	
    	
    	<beans:bean id="itemWriter" class="example.ExampleItemWriter" />
    	
    	<beans:bean id="bewebProcessor" class="com.beweb.batch.quartz.BewebProcessor" />
    	
    </beans:beans>
    What must I do to add another datasrouce?
    Must I define another step or can I work with the same step?

    Thank you very much for your help...

    Bertrand

  2. #2
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    There has to be a single transaction manager shared between your application code and Spring Batch, so that's the main constraint. Once you have sorted that out, you can start to think about how to provide your custom business logic. See this article for some deeper discussion of transaction semantics and multiple data sources: http://www.javaworld.com/javaworld/j...nsactions.html.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •