title: How to achieve loose coupling between JDBC drivers and source code?
body: <p>I don't want to make my code tight coupled to some JDBC driver (for example MySql). I want to make universal code, that can work with many database implementations. And I don't quite understand how to achieve this goal when using JDBC.</p>
  
  <p>I think to achieve this I need only to export driver class name(and connection string) to <code>.properties</code> file (for example <code>"com.mysql.jdbc.Driver"</code>), and then in code use it like this <code>Class.forName(PROPERTIES.getDriverName()).newInstance();</code> So when I decide to change my database, all what I need to change is jdbc driver name in <code>.properties</code> file (for example to <code>"COM.ibm.db2.jdbc.app.DB2Driver"</code> ), connection string, and change driver's <code>.jar</code> file in classpath.</p>
  
  <p>Is it right?</p>