Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to check different Database server competibility in java code

 
shyam malani
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to transefer my data from one Database server to another. is there any java Utillity availiable to check it @ code level for metadeta comitibility.basicly length and datatype.

Thanks in Advance
 
pankaj patil
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can either do database to database transfer using scripts.
OR
Write a code to read from 1st database and insert the same in 2nd database (bad solution)
 
pankaj patil
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is compatible with all database like Oracle ,SQL ,MYSQl and many more it is just the way the connection object is to be created.
The API for different Database differ so you have to download a specific API jar like classs12.jar for Oracle and keep the jar in the class path
 
shyam malani
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its fine what you said but im using 4 differenr databases those are in different applications.
now in my Application im fetching data from different Data servers and storing it on my local tables.

before saving i want sorce Tables metadata be checked and if its not comitible with destination Table it should show warning to admin that perticular tables perticular colom value is incompiteble.

Note- that should be done through java Utillity it means not manualy.
i wana know is ther any specific utility provided by java or not...


Thanks
 
shyam malani
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Pankaj
 
pankaj patil
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check for Common Gateway interface provided by Database.
i have not tried the same
 
Scott Selikoff
author
Saloon Keeper
Posts: 4015
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pankaj patil wrote:Write a code to read from 1st database and insert the same in 2nd database (bad solution)


I disagree. Writing a database tool that reads one database and inserts into another via JDBC is far less code than you might think. Also, it gives you total control of converting objects that are not the same data type between the two databases. The sad fact is many databases have their own, distinct data types making direct conversions non-trivial at times.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18221
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ummm. You do know that we're featuring someone (and her book) this week who describe a tool specifically designed to do what you're talking about WITHOUT doing the programming yourself?

Transferring data from one database to another is one of the primary functions of the Pentaho DI suite. I used Kettle back in January to migrate an entire database from Derby to DB2, in fact.

This week I'm spending most of my time laying out a Kettle process to extract selected data from that database, lookup codes, and generate CSV files that will be FTP'ed to another database at a remote location.

I don't know, however, that I could agree with Scott's assertion that it's "far less code than you might think", however. Like so many "All You Have To Do" endeavors, the home-grown approach tends to add requirements, grow, mutate, and otherwise attain a scale never imagined in the original conception. Having worked internal to Kettle's source code myself, I can say that its basic underpinnings aren't that complex, but the reality is fairly large.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4015
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Ummm. You do know that we're featuring someone (and her book) this week who describe a tool specifically designed to do what you're talking about WITHOUT doing the programming yourself?


Oops! But that doesn't mean transferring yourself isn't necessarily a bad idea ;) It's just not all developers feel comfortable doing so. I've done it using using JDBC meta API in a relatively small number of lines of code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic