Java - Fastest way to copy resultset?

Posted on 2013-10-25
Last Modified: 2013-10-25
Pretty straightforward:

I have two different connections to two different databases, and I need to find the absolute fastest way to move the data from a table in connection 1 to an identical table in connection 2.  

I'm hoping I don't have to go row-by-row with a bajillion "UPDATE" calls to do this.
Question by:Javin007
  • 3
  • 2
LVL 86

Accepted Solution

CEHJ earned 500 total points
ID: 39600694
It's often easier to use the tools of the rdbms to do this but failing that you could use one update statement (PreparedStatement) in batch mode

Author Comment

ID: 39600772
But wouldn't the prepared statement require me to loop through the result set record-by-record still?  I was hoping for some sort of more direct "bulk" method.
LVL 86

Expert Comment

ID: 39600837
Well that's how cursors work. Are you talking about Access by any chance?

Author Closing Comment

ID: 39601047
Sure enough, using the RDBMS's "INSERT INTO" statement I was able to insert to an external database, and it was quite fast.
LVL 86

Expert Comment

ID: 39601079

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question