title: connecting to multiple databases using different jdbc drivers
body: <p>I have a requirement to write a daemon based java process (Not web based) that will connect to an Oracle 10G database, read some data from it and then connect to a SQL Server database and write the data to a table. </p>
  
  <p>Sounds simple enough but i have a couple of queries about this. </p>
  
  <ul>
  <li><p>i will need to have two jdbc drivers, i.e. one for connecting to the Oracle database and the other for connecting to the sql server database. The sql server jdbc driver is the jtds jdbc driver (<a href="http://jtds.sourceforge.net/" rel="nofollow noreferrer">http://jtds.sourceforge.net/</a>) and for Oracle i will be using the standard oracle jdbc driver. Am i likely to come across any problems with both drivers available in the classpath together? </p></li>
  <li><p>My guess is that all i need is a ConnectionManager class to manage the connections and a client DAO class that would call the relevant method to get the connection it needs depending on whether it is reading from Oracle or writing to SQL Server. Is this a reasonable approach or is there a better design/pattern for this? </p></li>
  </ul>
  
  <h2>EDIT</h2>
  
  <p>Ok i have tried to put together a quick design solution. See image below</p>
  
  <p><img src="https://i279.photobucket.com/albums/kk128/ziggy_76/BlankPackage_Main-1.jpg" /></p>
  
  <p>The problem i think i am having is how to commit. Here is the flow of processing </p>
  
  <ul>
  <li>InvoiceBD gets an Oracle connection from the factory class and calls InvoiceUploadDAO.readData passing it the Oracle connection object. </li>
  <li>InvoiceBD get a SQL Server connection from the factory class and calls InvoiceUploadDAO.writeData passing it the SQL Server connection object. </li>
  <li>InvoiceBD reuses the Oracle connection to call InvoiceUploadDAO.update status to 'Complete' set status on the Oracle database.</li>
  </ul>
  
  <p>InvoiceBD commits the Oracle connection. 
  InvoiceBD commits the SQL Server connection. </p>
  
  <p>Or if something goes wrong both connection objects are rolled back. </p>
  
  <p>Does that sound about right? </p>
  
  <p>Thanks</p>