I have a number of database servers (different DBMS instances, installations in different physical locations), each of them contains data and uses the same schema. Most of the data is completely the same across all databases, but unfortunately not in every case.
I need to write an application that will issue queries (only selects, not inserts, updates or deletes) against a table across all databases, retrieve all results so that the tool can compare them to be able to report back possible discrepancies to users.
For example imagine that I have a web based form, where users enter company details. Submitting the form will issue an insert against the same table in all databases (via different database connection, each of them separate). While users typing the company's name the application needs to be able to verify that the value entered doesn't exist across all databases. If it exists or doesn't exist on all databases all is fine. Either the company name is taken or can be used by the user. However if the value exists on some databases, but not on others I have to raise a validation error.
The tool I'm writing is a Java application, using JDBC (connecting to multiple Oracle databases), so right now my thinking is that I create a Connection towards each of my database servers. Issue the same query in parallel, wait for the results and compare them. My use case involves a handful of users and 5-10 different database servers (database migration or slave/master replication is completely out of question).
What are the possible ways to handle a scenario like this?