File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

copy talble using jdbc

 
ZhiningZhang
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, all,
I have two two dababases. How to copy a table in one database to another database???
Thanks!
-Zhining
 
Simon Xu
Ranch Hand
Posts: 235
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just take out the data from the first table and store them into some variables and then insert them into second table.
regards
 
Jason Menard
Sheriff
Posts: 6450
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, using JDBC you could always query from one and insert the results into the other.
 
ZhiningZhang
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,Xu and Menard.
But my problem is I do not know the source table's schema ( how many columns, column's type ), only know table's name. I know I can use metadata in jdbc to get table's schema, then create a new table, and copy all data.
Is there a easy way to do it?
Thanks! -Zhining
 
vaibhav punekar
Ranch Hand
Posts: 134
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can download/copy one database to the other with ease if you are using SQL or ORACLE.They have the option of import/export database in management console.It will just ask for the location of the table,username password if any and start downloading.
Isn't it easy?You can even download the database of two different vendors.
 
vaibhav punekar
Ranch Hand
Posts: 134
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need of JDBC also.
 
ZhiningZhang
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My project is to write a utility using jdbc to convert database. The source database could be MS SQL Server on one server, while target database could be ORACLE on another server. I do not the schema of table ( different users could have different schema ), only know the table name.
I am wondering if there is a easy way to copy tables.
-Zhining
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic