aspose file tools*
The moose likes JDBC and the fly likes How to check different Database server competibility in java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to check different Database server competibility in java code" Watch "How to check different Database server competibility in java code" New topic
Author

How to check different Database server competibility in java code

shyam malani
Greenhorn

Joined: May 20, 2010
Posts: 3
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

Joined: Dec 19, 2004
Posts: 98
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)


Regards,
Pankaj Patil
pankaj patil
Ranch Hand

Joined: Dec 19, 2004
Posts: 98
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

Joined: May 20, 2010
Posts: 3
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

Joined: May 20, 2010
Posts: 3
Thanks Pankaj
pankaj patil
Ranch Hand

Joined: Dec 19, 2004
Posts: 98
Check for Common Gateway interface provided by Database.
i have not tried the same
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

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.


My Blog: Down Home Country Coding with Scott Selikoff
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to check different Database server competibility in java code
 
Similar Threads
Weblogic datasource problem
System exception on UserTransaction.commit() , followed by RollbackException
Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
which textbook / pdf / site is good to learn servlets and jsp in detail
To validate telnet connectivity in java code