Solved

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

Posted on 2002-07-01
4
298 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
  • 2
4 Comments
 

Expert Comment

by:erikjensen
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now