title: Loading the Postgresql JDBC 4.1 driver
body: <p>I want to connect to a PostgreSQL database using the JDBC 4.1 driver. I declared the following dependency in the <code>pom.xml</code>:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
      &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
      &lt;version&gt;9.3-1101-jdbc41&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>This puts <code>postgresql-9.3-1101-jdbc41.jar</code> into my classpath. I have read that it not necessary anymore to load the driver using <code>Class.forName()</code> if the driver is specified at <code>META-INF/services/java.sql.Driver</code>. The driver-jar has this file but I still get the following error:</p>
  
  <pre><code>No suitable driver found for jdbc:postgresql://localhost:5432
  </code></pre>
  
  <p>I just make a call to in a test and then run the tests using <code>mvn test</code>:</p>
  
  <pre><code>DriverManager.getConnection("jdbc:postgresql://localhost:5432");
  </code></pre>
  
  <p>Even if I call <code>Class.forName()</code> before I get the error. How do I get the driver loaded properly?</p>