cofactor
asked on
how to copy database table in java ?
I have a "copy" button in my jsp page.
When I click on copy button , I want to copy data from few tables to other few tables in the same database schema.
source table name and destination table name are different.
source column name and destination column name are different.
My database mysql 5 , Jboss 5 server , JDK 1.5
Whats the best approach I can think of ?
When I click on copy button , I want to copy data from few tables to other few tables in the same database schema.
source table name and destination table name are different.
source column name and destination column name are different.
My database mysql 5 , Jboss 5 server , JDK 1.5
Whats the best approach I can think of ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
When you click a button you can load the servlet which would
through jdbc execute sql command which would take columns
from one table and insert their values to another table using
the sql syntax like below:
insert into table1 (column1, column2, ...) select column1, column2 ... from another_table where ...
Look for some example of such query, say here:
http://stackoverflow.com/questions/74162/how-to-do-insert-into-a-table-records-extracted-from-another-table