Announcement Announcement Module
Collapse
No announcement yet.
2 datasource in one JdbcCursorItemReader? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment

    Working...
    X