Solved

Java - Fastest way to copy resultset?

Posted on 2013-10-25
5
469 Views
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.
0
Comment
Question by:Javin007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 86

Accepted Solution

by:
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
0
 
LVL 4

Author Comment

by:Javin007
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.
0
 
LVL 86

Expert Comment

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

Author Closing Comment

by:Javin007
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.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39601079
:)
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
View SQL database for NPS accounting 4 24
How to get data off Lotus Notes server 4 77
comparing two rows 10 40
Moving database to a shared server 7 35
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

752 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