Solved

Insert a recordset from one MySQL database into another MySQL database with JDBC

Posted on 2002-07-01
4
303 Views
Last Modified: 2012-05-04
I am not sure if this is possible, but I have 2 MySQL database connections and I want to take a recordset from one database and insert it into the other database connection without having to go through the recordset row by row and column by column.

Is it possible to insert a complete recordset with one statement?
0
Comment
Question by:bhadsock
[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
  • 2
4 Comments
 

Expert Comment

by:erikjensen
ID: 7122021
Sorry there is no way to insert a complete recordset with one statement the only way is row by row.

I am not familiar with MySQL, is there not some way to write a script in MySQL to do the job?
0
 

Author Comment

by:bhadsock
ID: 7122082
In MySQL, you can create an SQL statement that will insert data from a SELECT statement from another database.  Below is the the SQL statement I used when both databases lived on the same server:

INSERT INTO Database1Name.TableName SELECT * FROM Database2Name.TableName WHERE Database2Name.TableName.FieldName = 'SomeCriteria'

But now, the 2 databases are on 2 different database servers and therefore 2 different JDBC connections and each database is not aware of the other.

Is there a way to execute a similar SQL statement to the one I used above across 2 database connections?
0
 

Accepted Solution

by:
erikjensen earned 200 total points
ID: 7122140
Not possible, since JDBC knows nothing about database names, looks like you're stuck whith the row by row method.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8893671
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to erikjensen

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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 about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

695 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