• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Generic way of data transfer

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
in my program i want to extract data from one table ( contains colums of different datatypes ) and insert that into another table. I want my program to be so generic so that i need to just pass the source table and the destination table is it is possible to so.... and if so pls. let me know how to do that...

Data base == Microsoft SQLServer
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if your RDBMS is SQL Server I'd always say looks at DTS before starting to write your own version of it.

That being said, you have a number of routes to possibly try. JDBC has the javax.sql.DatabaseMetaData interface, full of useful methods to discover information about a database object. Alternatively you might consider an ORM technology, such as Hibernate, which removes some of the nuts-and-bolts programming.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"vijay",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Raj Kumar
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the reply Paul Sturrock ,

as i'am new to the use of "DatabaseMetaData" i don't know how to proceed with that can you give me s very small example of how to use the above interface in an effective way....

waiting for your reply.....
 
Raj Kumar
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I got some knowledge about the Interface "DatabaseMetaData" ( tried with small programs)

Now let me tell the exact need


There are two database ( let's name it "DB1" & "DB2") with the same structure . Database base "DB1"
have data of resources ( lets name it "R1","R2","R3") and "DB2" is empty now i need to copy the data
which is related to resource "R2" alone to the database "DB2".


Upto what level does the interface "DatabaseMetaData" support this and is there any other
better option to do this

Friends i need your valuable reply....


Database == MSSQLServer
reply
    Bookmark Topic Watch Topic
  • New Topic