Solved

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

Posted on 2002-07-01
4
302 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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
servlet example 11 58
check java version using powershell 13 297
import as existing maven project 3 38
passing enum to a method 4 35
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.

749 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