java - Connecting two databases and writting in single query? -


there 2 seperate db involved , both phisically 2 different places. in application, used spring batch , implemented this:

1.fetching ids as/400 database(master db) 2.comparing sql db (my application) ids , ever ids existed in sql db, updating ids information local db(my sql). disadvantage : assume as400 db has 10 ids , in application has 2 ids, in order data reading 10 ids. waste of time , lack of efficiency right?!

here code using in spring batch fetch data :

<bean id="patternsitemreader" class="org.springframework.batch.item.database.jdbccursoritemreader">                     <property name="sql" value="select                                                         j3patt patternid,                                                         j3ptyp patterntype,                                                         j3clas patternclass,                                                         j3rept repeat,                                                         j3clrs numofcolors,                                                         joentt event,                                                         j3act activity                                                         test006966.jqp030h rrn(a) >=( select max(rrn(b))                                                         test006966.jqp030h b a.j3patt = b. j3patt) , j3sts = 'n' order                                                         j3patt, jodate desc ,jotime desc                                                         "/>                          <property name="rowmapper">                                     <bean class="org.springframework.jdbc.core.beanpropertyrowmapper">                                                 <property name="mappedclass" value="com.mohawkind.batch.patterns.patternsrowmapper"/>                                     </bean>                         </property>                         <property name="datasource" ref="as400datasource" />             </bean>          <bean id="patternsitemwriter" class="com.mohawkind.batch.patterns.patternswritter" /> 

what looking :

i want solution fetch data existed in local(sql db). possible connecting 2 db , fetching data through spring batch jobs??

any ideas,suggestions appreciated. in advance..

is not possible create database view using query?


Comments