Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generic way of data transfer

 
Raj Kumar
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • 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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic