0

Hi,

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.

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by smantscheff
0

Hi smantscheff,

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

INSERT INTO EmpTable SELECT * FROM TestDB.emptb

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.