How to copy table from one database to another?

前端 未结 2 1247
你的背包
你的背包 2020-12-11 03:29

I need to take a table from one database and upload it to a different database. So, I create two separate connection . Here is my code

Connection connectio         


        
2条回答
  •  再見小時候
    2020-12-11 04:06

    If you don't want to manually list out all the field names for every table in the database, you should be able to do this two-step process instead:

    1. Copy the table schema using the answer in this question.
    2. Use resultSet.getMetaData() to get the list of fields, and use that to drive a modified version of the SELECT/INSERT code in @Wyzard's answer.

    I will post code here if I get it working.

提交回复
热议问题