title: How are JDBC drivers loaded without Class.forName() or System Properties?
body: <p>I am trying to understand JDBC internals, specifically, how is my JDBC driver being loaded if 
  1. I am not using Class.forName()
  2. Checking for the jdbc.driver system property returns null. </p>
  
  <p>I've tried checking my class path and printing the full list of system properties to the console for inspection as per <a href="https://docs.oracle.com/javase/8/docs/api/java/sql/DriverManager.html#registerDriver-java.sql.Driver-" rel="nofollow noreferrer">https://docs.oracle.com/javase/8/docs/api/java/sql/DriverManager.html#registerDriver-java.sql.Driver-</a> and <a href="https://db.apache.org/derby/docs/10.4/devguide/cdevdvlp40653.html" rel="nofollow noreferrer">https://db.apache.org/derby/docs/10.4/devguide/cdevdvlp40653.html</a></p>
  
  <p>Below is the DBConnection constructor from DBConnection class</p>
  
  <pre><code>    `public DBConnection() {
          try {
              this.conn = DriverManager.getConnection(JDBC_URL);
              if (this.conn != null) {
                  System.out.println("Connection successful");
              }
          } catch(SQLException sqlex) {
              System.out.println("Connection failed");
          }
      }`
  </code></pre>
  Below is main() 
  
  <pre><code>
      public static void main(String[] args) {
  
          DBConnection dbTest = new DBConnection();
  
          String sysPropsString = System.getProperties().toString();
          String[] propsArr = sysPropsString.split(",");
  
          for(String property : propsArr) {
              if (property.contains("class") &amp;&amp; property.contains("path") 
                      &amp;&amp; (property.contains("derby") || property.contains("drivers")))
                  System.out.println(property);
          }
          System.out.println("***********************************");
          String sysDrivers = System.getProperty("jdbc.drivers");
          System.out.println(sysDrivers);
      }
  
  
  </code></pre>
  
  <p>I expected to have the derby jdbc driver printed to the console from the System.getProperty() call OR to find it somewhere on the classpath, but I see neither. How is the derby driver being loaded?</p>
  
  <p>Below is the output: </p>
  
  <blockquote>
    <p>Connection successful</p>
    
    <blockquote>
      <p>java.class.path=/Users/aslotu/eclipse-workspace/Bullhorn/build/classes:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_cs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_de_DE.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_es.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_fr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_hu.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_it.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_ja_JP.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_ko_KR.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_pl.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_pt_BR.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_ru.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_zh_CN.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derbyLocale_zh_TW.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/db/lib/derby.jar</p>
      
      <hr>
      
      <p>null</p>
    </blockquote>
  </blockquote>