title: Multiple DAO's vs One DAO with configuration file
body: <p>I'm currently in the process of creating a data access layer for an application. This application will initially connect to an Oracle database but will later also connect to a DB2 database.</p>
  
  <p>For connecting to the database I will use JDBC. At this time I'm considering my options. As I see it I have two (primary) options.</p>
  
  <p>1) Create a design with support for multiple DAO factories, each instantiating the DAO's specific to their database. Initially, this design will only have one factory. Later it will be extended with a second factory and DAO classes.</p>
  
  <p>2) Create one DAO factory which instantiates multiple DAO's for the different models. This DAO factory builds the DAO's based on a configuration file, which contains the JDBC driver path and connection url.</p>
  
  <p>I'm tempted to choose the second option, which seems to remove quite some code duplication in the DAO's. Could anyone give the pros and cons of both approaches?</p>
  
  <p>Why would you choose for multiple DAO factories (abstract factory pattern) when you don't really need it when using JDBC?</p>