I am working on web application in java.

I need to copy table from local database to web table database.

So please help me solve this query.

Thanks in advance.

What did you try already and what did not work as expected?

Hi smantscheff,

I have copied one table of database to another database table by using following mysql query on same machine


here made connection to EmpTable of TempDB database through jaca code and another database is TestDB on same machine.
Using this query copid TestDB.emptb data to EmpTable.

But I want to TempDB on webserver and TestDB on local machine. so in that condition how to copy data of TestDB to TempDB.

Thank's for reply

You cannot do this in one query because a query works in the context of a database connection, and for different servers you need different connections.
So probably mwasifs proposal to use mysqldump is the fastest way. You can do it with one line on the command line of your local machine: mysqldump -h <yourwebhost> -u <user> -p <password> TestDB emptb | mysql TempDB The new table would have the same name as the old one. If you want to rename it, you could either add one line of mysql or filter the above line through sed.