diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 819e671..781ea33 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -1018,6 +1018,10 @@ function install_settings_form($form, &$form_state, &$install_state) {
 function install_settings_form_validate($form, &$form_state) {
   $driver = $form_state['values']['driver'];
   $database = $form_state['values'][$driver];
+  $drivers = drupal_get_database_types();
+  if ($drivers[$driver]->isCustom()) {
+    $database['custom'] = TRUE;
+  }
   $database['driver'] = $driver;
 
   // TODO: remove when PIFR will be updated to use 'db_prefix' instead of
diff --git a/core/includes/install.inc b/core/includes/install.inc
index e9d666f..769dbf9 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -139,6 +139,16 @@ function drupal_get_database_types() {
       $drivers[$file->filename] = $file->uri;
     }
   }
+  if (is_dir(DRUPAL_ROOT . '/db_drivers')) {
+    $files = file_scan_directory(DRUPAL_ROOT . '/db_drivers', '/^[a-z_]+$/i', array('recurse' => FALSE));
+    foreach ($files as $uri => $file) {
+      $file->uri .= "/lib/Drupal/$file->filename";
+      if (file_exists($file->uri . '/Install/Tasks.php')) {
+        $drivers[$file->filename] = $file->uri;
+        drupal_classloader_register($file->filename, "db_drivers/$file->filename");
+      }
+    }
+  }
 
   foreach ($drivers as $driver => $file) {
     $installer = db_installer_object($driver);
@@ -954,5 +964,11 @@ function db_installer_object($driver) {
   // We cannot use Database::getConnection->getDriverClass() here, because
   // the connection object is not yet functional.
   $task_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\Install\\Tasks";
-  return new $task_class();
+  if (class_exists($task_class)) {
+    return new $task_class();
+  }
+  else {
+    $task_class = "Drupal\\{$driver}\\Install\\Tasks";
+    return new $task_class();
+  }
 }
diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php
index 51efaf4..53a92da 100644
--- a/core/lib/Drupal/Core/Database/Connection.php
+++ b/core/lib/Drupal/Core/Database/Connection.php
@@ -620,7 +620,12 @@ protected function expandArguments(&$query, &$args) {
   public function getDriverClass($class) {
     if (empty($this->driverClasses[$class])) {
       $driver = $this->driver();
-      $driver_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\{$class}";
+      if (!empty($this->connectionOptions['custom'])) {
+        $driver_class  = "Drupal\\{$driver}\\{$class}";
+      }
+      else {
+        $driver_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\{$class}";
+      }
       $this->driverClasses[$class] = class_exists($driver_class) ? $driver_class : $class;
     }
     return $this->driverClasses[$class];
diff --git a/core/lib/Drupal/Core/Database/Database.php b/core/lib/Drupal/Core/Database/Database.php
index 25fe8fa..d9ecf90 100644
--- a/core/lib/Drupal/Core/Database/Database.php
+++ b/core/lib/Drupal/Core/Database/Database.php
@@ -369,12 +369,17 @@ public static function addConnectionInfo($key, $target, $info) {
     if (!isset(self::$databaseInfo[$key])) {
       throw new ConnectionNotDefinedException('The specified database connection is not defined: ' . $key);
     }
-
     if (!$driver = self::$databaseInfo[$key][$target]['driver']) {
       throw new DriverNotSpecifiedException('Driver not specified for this database connection: ' . $key);
     }
 
-    $driver_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\Connection";
+    if (!empty(self::$databaseInfo[$key][$target]['custom'])) {
+      drupal_classloader_register($driver, "db_drivers/$driver");
+      $driver_class = "Drupal\\{$driver}\\Connection";
+    }
+    else {
+      $driver_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\Connection";
+    }
     $new_connection = new $driver_class(self::$databaseInfo[$key][$target]);
     $new_connection->setTarget($target);
     $new_connection->setKey($key);
diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php
index ab1f771..93767de 100644
--- a/core/lib/Drupal/Core/Database/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Install/Tasks.php
@@ -302,4 +302,13 @@ public function validateDatabaseSettings($database) {
     return $errors;
   }
 
+  /**
+   * Core driver?
+   *
+   * @return
+   *   TRUE if this is a custom driver, FALSE if the driver is in core.
+   */
+  public function isCustom() {
+    return FALSE;
+  }
 }
