title: Doctrine 2 - How to add custom DBAL driver?
body: <p>How can I add my custom driver without modifying DriverManager.php in the Doctrine2 core?</p>
  
  <p>I have created a DBAL Driver for <code>pdo_dblib</code> and placed it inside a Symfony2 bundle. This works fine, however I must add my driver to a list of hard-coded drivers in DriverManager.php, otherwise I get the following exception:</p>
  
  <p><strong>Exception</strong></p>
  
  
  
  <pre class="lang-none prettyprint-override"><code>[Doctrine\DBAL\DBALException]                                                                                                                                                   
  The given 'driver' pdo_dblib is unknown, Doctrine currently supports only the following drivers: pdo_mysql, pdo_sqlite, pdo_pgsql, pdo_oci, oci8, ibm_db2, pdo_ibm, pdo_sqlsrv
  </code></pre>
  
  <p><strong>Unless I modify DriverManager.php</strong></p>
  
  
  
  <pre class="lang-php prettyprint-override"><code>final class DriverManager
  {
      private static $_driverMap = array(
          'pdo_dblib' =&gt; 'Doctrine\DBAL\Driver\PDODblib\Driver', // Added this line
      );
  }
  </code></pre>
  
  <p><strong>Here's my config.yml:</strong></p>
  
  
  
  <pre class="lang-yaml prettyprint-override"><code># Doctrine Configuration
  doctrine:
      dbal:
          driver:         pdo_dblib
          driver_class:   PDODblibBundle\Doctrine\DBAL\Driver\PDODblib\Driver
  </code></pre>