Announcement Announcement Module
No announcement yet.
Reading from multiple databases and insert/update in another table Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading from multiple databases and insert/update in another table


    I have two databases database1,database2

    each database having a table where i store records the columns are as follows


    each table contains 1 MN(million) records

    so i need to process millions of records say 2 MN

    i need to fetch and process these records based on some logic and need to update the database1 table with
    new totalprice and totalinvoice against CID.

    CID, TotalPrice, TotalInvoices
    123 1000 5

    CID, TotalPrice, TotalInvoices
    123 200 3
    124 100 2

    so tables in each database my contain same CID related records.

    for fetching the records from individual table i issue query

    select CID,SUM(TotalPrice),SUM(TotalInvoices) from database1.table1 groupby CID (kind of to fetch SUM of TotalPrice and SUM of TotalInvoices for a CID

    After fetching records from each table form individual database i need to SUM individual records TotalPrice, TotalInvoices for individual CID.

    So in the above Ex.. after processed it will be
    CID TotalPrice TotalInvoices
    123 1200 8
    124 100 2

    Is spring batch is suggestable for this. please guide me how to achieve this.

    Thanks & Regards

  • #2
    Hopping on this thread since I have a similar problem. I will post what I find.