Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

copy talble using jdbc

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No need of JDBC also.
 
ZhiningZhang
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic