Results 1 to 2 of 2

Thread: Doing a batch Select (DB1) to batch Insert (DB2) with Spring

  1. #1
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    54

    Default Doing a batch Select (DB1) to batch Insert (DB2) with Spring

    Hi,

    is there a convenient way to do a batch "select * from product" from a Database 1 and getting doing a batch Insert in DataBase 2 with Spring. I see that the JDBCTemplate return a List with the queryForList() method. The problem here is that the list returned might be too big. I need to transfert 10 million records from DataBase1 to DataBase2.

    The best way, I guess, would be to insert the row from the RecordSet parsing loop.

    Can I use the RowCallbackHandler to do this job?

    I need to do this job :
    Code:
    - resultSet = getTheResultSet("Select * from Product");
    - Start While (looping in ResultSet){
    -- get row from ResultSet...
    -- Insert Row from ResultSet to Row In DataBase2
    -End while.
    -close all jdbc stuff.
    Should I do it in plain jdbc or can I use the Spring framework?


    Thanks.

    Etienne

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    I don't think there is anything in Spring specifically for this scenario, but you can still use Spring's JDBC templates.

    The best way, I guess, would be to insert the row from the RecordSet parsing loop
    Try submitting the inserts as a batch (Statement.addBatch). You can vary the size to find the optimum batch size.

    You might be interested to follow this thread (which has no replies yet).

Similar Threads

  1. Replies: 37
    Last Post: Aug 10th, 2009, 03:35 PM
  2. MySQL DDL
    By analogueboy in forum Security
    Replies: 5
    Last Post: Aug 17th, 2007, 03:48 PM
  3. hibernate pagination
    By oliverchua in forum Data
    Replies: 8
    Last Post: Sep 23rd, 2005, 06:06 PM
  4. Replies: 2
    Last Post: May 5th, 2005, 09:35 PM
  5. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM

Posting Permissions

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