aspose file tools*
The moose likes JDBC and the fly likes Generic way of data transfer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Generic way of data transfer" Watch "Generic way of data transfer" New topic
Author

Generic way of data transfer

Raj Kumar
Ranch Hand

Joined: Sep 19, 2005
Posts: 65
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
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61662
    
  67

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Raj Kumar
Ranch Hand

Joined: Sep 19, 2005
Posts: 65
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

Joined: Sep 19, 2005
Posts: 65
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generic way of data transfer