diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index fdcb01b..4ec9f5b3 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1,7 +1,6 @@
 <?php
 
 use Drupal\Component\Utility\NestedArray;
-use Drupal\Core\Database\Database;
 use Symfony\Component\ClassLoader\UniversalClassLoader;
 use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
 use Symfony\Component\DependencyInjection\Container;
@@ -725,13 +724,16 @@ function drupal_settings_initialize() {
   global $base_url, $base_path, $base_root, $script_path;
 
   // Export these settings.php variables to the global namespace.
-  global $databases, $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url, $db_prefix, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url, $config_directories;
+  global $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url, $db_prefix, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url, $config_directories;
   $conf = array();
 
   // Make conf_path() available as local variable in settings.php.
   $conf_path = conf_path();
   if (is_readable(DRUPAL_ROOT . '/' . $conf_path . '/settings.php')) {
     include_once DRUPAL_ROOT . '/' . $conf_path . '/settings.php';
+    if (!empty($databases)) {
+      drupal_container()->setParameter('database.info', $databases);
+    }
   }
   $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
 
@@ -2241,14 +2243,14 @@ function _drupal_bootstrap_configuration() {
   drupal_environment_initialize();
   // Start a page timer:
   timer_start('page');
+  // Activate the class loader.
+  drupal_classloader();
   // Initialize the configuration, including variables from settings.php.
   drupal_settings_initialize();
 
   // Make sure we are using the test database prefix in child Drupal sites.
   _drupal_initialize_db_test_prefix();
 
-  // Activate the class loader.
-  drupal_classloader();
 
   // Load the procedural configuration system helper functions.
   require_once DRUPAL_ROOT . '/core/includes/config.inc';
@@ -2323,7 +2325,8 @@ function _drupal_initialize_db_test_prefix() {
     $test_info['test_run_id'] = $test_prefix;
     $test_info['in_child_site'] = TRUE;
 
-    foreach ($GLOBALS['databases']['default'] as &$value) {
+    $databases = drupal_container()->getParameter('database.info');
+    foreach ($databases['default'] as &$value) {
       // Extract the current default database prefix.
       if (!isset($value['prefix'])) {
         $current_prefix = '';
@@ -2340,6 +2343,7 @@ function _drupal_initialize_db_test_prefix() {
         'default' => $current_prefix . $test_prefix,
       );
     }
+    drupal_container()->setParameter('database.info', $databases);
   }
 }
 
@@ -2350,12 +2354,11 @@ function _drupal_bootstrap_database() {
   // Redirect the user to the installation script if Drupal has not been
   // installed yet (i.e., if no $databases array has been defined in the
   // settings.php file) and we are not already installing.
-  if (empty($GLOBALS['databases']) && !drupal_installation_attempted()) {
+  if (!drupal_container()->hasParameter('database.info') && !drupal_installation_attempted()) {
     include_once DRUPAL_ROOT . '/core/includes/install.inc';
     install_goto('core/install.php');
   }
 
-
   // Initialize the database system. Note that the connection
   // won't be initialized until it is actually requested.
   require_once DRUPAL_ROOT . '/core/includes/database.inc';
@@ -2424,9 +2427,17 @@ function drupal_container(Container $new_container = NULL, $rebuild = FALSE) {
   // would leave Drupal in a nonfunctional state.
   static $container = NULL;
   if ($rebuild) {
+    // If there is an existing container, close open connnections.
+    if ($container) {
+      $container->get('database_manager')->closeConnection();
+    }
     $container = NULL;
   }
   if (isset($new_container)) {
+    // If there is an existing container, close open connnections.
+    if ($container) {
+      $container->get('database_manager')->closeConnection();
+    }
     $container = $new_container;
   }
   if (!isset($container)) {
@@ -2440,6 +2451,7 @@ function drupal_container(Container $new_container = NULL, $rebuild = FALSE) {
     $container
       ->register('config.cachedstorage.storage', 'Drupal\Core\Config\FileStorage')
       ->addArgument(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY));
+
     // @todo Replace this with a cache.factory service plus 'config' argument.
     $container
       ->register('cache.config')
@@ -2447,6 +2459,21 @@ function drupal_container(Container $new_container = NULL, $rebuild = FALSE) {
       ->setFactoryMethod('get')
       ->addArgument('config');
 
+    // This will be overridden in drupal_settings_initialize().
+    $container->setParameter('database.info', array());
+
+    $container->register('database_manager', 'Drupal\Core\Database\Database')
+      ->addArgument('%database.info%');
+    $container->register('database', 'Drupal\Core\Database\Connection')
+      ->setFactoryService('database_manager')
+      ->setFactoryMethod('getConnection')
+      ->addArgument('default');
+    $container->register('database.slave', 'Drupal\Core\Database\Connection')
+      ->setFactoryService('database_manager')
+      ->setFactoryMethod('getConnection')
+      ->addArgument('slave');
+
+
     $container
       ->register('config.storage', 'Drupal\Core\Config\CachedStorage')
       ->addArgument(new Reference('config.cachedstorage.storage'))
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 0f252ca..7ce43db 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -4809,10 +4809,10 @@ function drupal_json_decode($var) {
  *   A salt based on information in settings.php, not in the database.
  */
 function drupal_get_hash_salt() {
-  global $drupal_hash_salt, $databases;
+  global $drupal_hash_salt;
   // If the $drupal_hash_salt variable is empty, a hash of the serialized
   // database credentials is used as a fallback salt.
-  return empty($drupal_hash_salt) ? hash('sha256', serialize($databases)) : $drupal_hash_salt;
+  return empty($drupal_hash_salt) ? hash('sha256', serialize(drupal_container()->getParameter('database.info'))) : $drupal_hash_salt;
 }
 
 /**
diff --git a/core/includes/database.inc b/core/includes/database.inc
index fc76b6f..1c3c6d3 100644
--- a/core/includes/database.inc
+++ b/core/includes/database.inc
@@ -1,6 +1,5 @@
 <?php
 
-use Drupal\Core\Database\Database;
 use Drupal\Core\Database\Query\Condition;
 
 /**
@@ -208,11 +207,8 @@
  * @see DatabaseConnection::defaultOptions()
  */
 function db_query($query, array $args = array(), array $options = array()) {
-  if (empty($options['target'])) {
-    $options['target'] = 'default';
-  }
-
-  return Database::getConnection($options['target'])->query($query, $args, $options);
+  $service = empty($options['target']) || $options['target'] == 'default' ? 'database' : 'database.slave';
+  return drupal_container()->get($service)->query($query, $args, $options);
 }
 
 /**
@@ -240,11 +236,8 @@ function db_query($query, array $args = array(), array $options = array()) {
  * @see DatabaseConnection::defaultOptions()
  */
 function db_query_range($query, $from, $count, array $args = array(), array $options = array()) {
-  if (empty($options['target'])) {
-    $options['target'] = 'default';
-  }
-
-  return Database::getConnection($options['target'])->queryRange($query, $from, $count, $args, $options);
+  $service = empty($options['target']) || $options['target'] == 'default' ? 'database' : 'database.slave';
+  return drupal_container()->get($service)->queryRange($query, $from, $count, $args, $options);
 }
 
 /**
@@ -270,11 +263,8 @@ function db_query_range($query, $from, $count, array $args = array(), array $opt
  * @see DatabaseConnection::defaultOptions()
  */
 function db_query_temporary($query, array $args = array(), array $options = array()) {
-  if (empty($options['target'])) {
-    $options['target'] = 'default';
-  }
-
-  return Database::getConnection($options['target'])->queryTemporary($query, $args, $options);
+  $service = empty($options['target']) || $options['target'] == 'default' ? 'database' : 'database.slave';
+  return drupal_container()->get($service)->queryTemporary($query, $args, $options);
 }
 
 /**
@@ -289,10 +279,8 @@ function db_query_temporary($query, array $args = array(), array $options = arra
  *   A new InsertQuery object for this connection.
  */
 function db_insert($table, array $options = array()) {
-  if (empty($options['target']) || $options['target'] == 'slave') {
-    $options['target'] = 'default';
-  }
-  return Database::getConnection($options['target'])->insert($table, $options);
+  $service = empty($options['target']) || $options['target'] == 'default' ? 'database' : 'database.slave';
+  return drupal_container()->get($service)->insert($table, $options);
 }
 
 /**
@@ -307,10 +295,8 @@ function db_insert($table, array $options = array()) {
  *   A new MergeQuery object for this connection.
  */
 function db_merge($table, array $options = array()) {
-  if (empty($options['target']) || $options['target'] == 'slave') {
-    $options['target'] = 'default';
-  }
-  return Database::getConnection($options['target'])->merge($table, $options);
+  $service = empty($options['target']) || $options['target'] == 'default' ? 'database' : 'database.slave';
+  return drupal_container()->get($service)->merge($table, $options);
 }
 
 /**
@@ -325,10 +311,8 @@ function db_merge($table, array $options = array()) {
  *   A new UpdateQuery object for this connection.
  */
 function db_update($table, array $options = array()) {
-  if (empty($options['target']) || $options['target'] == 'slave') {
-    $options['target'] = 'default';
-  }
-  return Database::getConnection($options['target'])->update($table, $options);
+  $service = empty($options['target']) || $options['target'] == 'default' ? 'database' : 'database.slave';
+  return drupal_container()->get($service)->update($table, $options);
 }
 
 /**
@@ -343,10 +327,8 @@ function db_update($table, array $options = array()) {
  *   A new DeleteQuery object for this connection.
  */
 function db_delete($table, array $options = array()) {
-  if (empty($options['target']) || $options['target'] == 'slave') {
-    $options['target'] = 'default';
-  }
-  return Database::getConnection($options['target'])->delete($table, $options);
+  $service = empty($options['target']) || $options['target'] == 'default' ? 'database' : 'database.slave';
+  return drupal_container()->get($service)->delete($table, $options);
 }
 
 /**
@@ -361,10 +343,8 @@ function db_delete($table, array $options = array()) {
  *   A new TruncateQuery object for this connection.
  */
 function db_truncate($table, array $options = array()) {
-  if (empty($options['target']) || $options['target'] == 'slave') {
-    $options['target'] = 'default';
-  }
-  return Database::getConnection($options['target'])->truncate($table, $options);
+  $service = empty($options['target']) || $options['target'] == 'default' ? 'database' : 'database.slave';
+  return drupal_container()->get($service)->truncate($table, $options);
 }
 
 /**
@@ -382,10 +362,8 @@ function db_truncate($table, array $options = array()) {
  *   A new SelectQuery object for this connection.
  */
 function db_select($table, $alias = NULL, array $options = array()) {
-  if (empty($options['target'])) {
-    $options['target'] = 'default';
-  }
-  return Database::getConnection($options['target'])->select($table, $alias, $options);
+  $service = empty($options['target']) || $options['target'] == 'default' ? 'database' : 'database.slave';
+  return drupal_container()->get($service)->select($table, $alias, $options);
 }
 
 /**
@@ -401,10 +379,8 @@ function db_select($table, $alias = NULL, array $options = array()) {
  *   A new DatabaseTransaction object for this connection.
  */
 function db_transaction($name = NULL, array $options = array()) {
-  if (empty($options['target'])) {
-    $options['target'] = 'default';
-  }
-  return Database::getConnection($options['target'])->startTransaction($name);
+  $service = empty($options['target']) || $options['target'] == 'default' ? 'database' : 'database.slave';
+  return drupal_container()->get($service)->startTransaction($name);
 }
 
 /**
@@ -417,7 +393,7 @@ function db_transaction($name = NULL, array $options = array()) {
  *   The key of the formerly active database.
  */
 function db_set_active($key = 'default') {
-  return Database::setActiveConnection($key);
+  return drupal_container()->get('database_manager')->setActiveConnection($key);
 }
 
 /**
@@ -432,7 +408,7 @@ function db_set_active($key = 'default') {
  *   The escaped table name as a string.
  */
 function db_escape_table($table) {
-  return Database::getConnection()->escapeTable($table);
+  return drupal_container()->get('database')->escapeTable($table);
 }
 
 /**
@@ -447,7 +423,7 @@ function db_escape_table($table) {
  *   The escaped field name as a string.
  */
 function db_escape_field($field) {
-  return Database::getConnection()->escapeField($field);
+  return drupal_container()->get('database')->escapeField($field);
 }
 
 /**
@@ -481,7 +457,7 @@ function db_escape_field($field) {
  *   The escaped string.
  */
 function db_like($string) {
-  return Database::getConnection()->escapeLike($string);
+  return drupal_container()->get('database')->escapeLike($string);
 }
 
 /**
@@ -491,7 +467,7 @@ function db_like($string) {
  *   The name of the currently active database driver.
  */
 function db_driver() {
-  return Database::getConnection()->driver();
+  return drupal_container()->get('database')->driver();
 }
 
 /**
@@ -505,7 +481,7 @@ function db_close(array $options = array()) {
   if (empty($options['target'])) {
     $options['target'] = NULL;
   }
-  Database::closeConnection($options['target']);
+  drupal_container()->get('database_manager')->closeConnection($options['target']);
 }
 
 /**
@@ -524,7 +500,7 @@ function db_close(array $options = array()) {
  *   An integer number larger than any number returned before for this sequence.
  */
 function db_next_id($existing_id = 0) {
-  return Database::getConnection()->nextId($existing_id);
+  return drupal_container()->get('database')->nextId($existing_id);
 }
 
 /**
@@ -587,7 +563,7 @@ function db_condition($conjunction) {
  *   A Schema API table definition array.
  */
 function db_create_table($name, $table) {
-  return Database::getConnection()->schema()->createTable($name, $table);
+  return drupal_container()->get('database')->schema()->createTable($name, $table);
 }
 
 /**
@@ -603,7 +579,7 @@ function db_create_table($name, $table) {
  *   An array of field names.
  */
 function db_field_names($fields) {
-  return Database::getConnection()->schema()->fieldNames($fields);
+  return drupal_container()->get('database')->schema()->fieldNames($fields);
 }
 
 /**
@@ -618,7 +594,7 @@ function db_field_names($fields) {
  *   TRUE if the given index exists, otherwise FALSE.
  */
 function db_index_exists($table, $name) {
-  return Database::getConnection()->schema()->indexExists($table, $name);
+  return drupal_container()->get('database')->schema()->indexExists($table, $name);
 }
 
 /**
@@ -631,7 +607,7 @@ function db_index_exists($table, $name) {
  *   TRUE if the given table exists, otherwise FALSE.
  */
 function db_table_exists($table) {
-  return Database::getConnection()->schema()->tableExists($table);
+  return drupal_container()->get('database')->schema()->tableExists($table);
 }
 
 /**
@@ -646,7 +622,7 @@ function db_table_exists($table) {
  *   TRUE if the given column exists, otherwise FALSE.
  */
 function db_field_exists($table, $field) {
-  return Database::getConnection()->schema()->fieldExists($table, $field);
+  return drupal_container()->get('database')->schema()->fieldExists($table, $field);
 }
 
 /**
@@ -660,11 +636,11 @@ function db_field_exists($table, $field) {
  *   Array, both the keys and the values are the matching tables.
  */
 function db_find_tables($table_expression) {
-  return Database::getConnection()->schema()->findTables($table_expression);
+  return drupal_container()->get('database')->schema()->findTables($table_expression);
 }
 
 function _db_create_keys_sql($spec) {
-  return Database::getConnection()->schema()->createKeysSql($spec);
+  return drupal_container()->get('database')->schema()->createKeysSql($spec);
 }
 
 /**
@@ -676,7 +652,7 @@ function _db_create_keys_sql($spec) {
  *   The new name for the table.
  */
 function db_rename_table($table, $new_name) {
-  return Database::getConnection()->schema()->renameTable($table, $new_name);
+  return drupal_container()->get('database')->schema()->renameTable($table, $new_name);
 }
 
 /**
@@ -686,7 +662,7 @@ function db_rename_table($table, $new_name) {
  *   The table to be dropped.
  */
 function db_drop_table($table) {
-  return Database::getConnection()->schema()->dropTable($table);
+  return drupal_container()->get('database')->schema()->dropTable($table);
 }
 
 /**
@@ -711,7 +687,7 @@ function db_drop_table($table) {
  * @see db_change_field()
  */
 function db_add_field($table, $field, $spec, $keys_new = array()) {
-  return Database::getConnection()->schema()->addField($table, $field, $spec, $keys_new);
+  return drupal_container()->get('database')->schema()->addField($table, $field, $spec, $keys_new);
 }
 
 /**
@@ -723,7 +699,7 @@ function db_add_field($table, $field, $spec, $keys_new = array()) {
  *   The field to be dropped.
  */
 function db_drop_field($table, $field) {
-  return Database::getConnection()->schema()->dropField($table, $field);
+  return drupal_container()->get('database')->schema()->dropField($table, $field);
 }
 
 /**
@@ -737,7 +713,7 @@ function db_drop_field($table, $field) {
  *   Default value to be set. NULL for 'default NULL'.
  */
 function db_field_set_default($table, $field, $default) {
-  return Database::getConnection()->schema()->fieldSetDefault($table, $field, $default);
+  return drupal_container()->get('database')->schema()->fieldSetDefault($table, $field, $default);
 }
 
 /**
@@ -749,7 +725,7 @@ function db_field_set_default($table, $field, $default) {
  *   The field to be altered.
  */
 function db_field_set_no_default($table, $field) {
-  return Database::getConnection()->schema()->fieldSetNoDefault($table, $field);
+  return drupal_container()->get('database')->schema()->fieldSetNoDefault($table, $field);
 }
 
 /**
@@ -761,7 +737,7 @@ function db_field_set_no_default($table, $field) {
  *   Array of fields for the primary key.
  */
 function db_add_primary_key($table, $fields) {
-  return Database::getConnection()->schema()->addPrimaryKey($table, $fields);
+  return drupal_container()->get('database')->schema()->addPrimaryKey($table, $fields);
 }
 
 /**
@@ -771,7 +747,7 @@ function db_add_primary_key($table, $fields) {
  *   Name of the table to be altered.
  */
 function db_drop_primary_key($table) {
-  return Database::getConnection()->schema()->dropPrimaryKey($table);
+  return drupal_container()->get('database')->schema()->dropPrimaryKey($table);
 }
 
 /**
@@ -785,7 +761,7 @@ function db_drop_primary_key($table) {
  *   An array of field names.
  */
 function db_add_unique_key($table, $name, $fields) {
-  return Database::getConnection()->schema()->addUniqueKey($table, $name, $fields);
+  return drupal_container()->get('database')->schema()->addUniqueKey($table, $name, $fields);
 }
 
 /**
@@ -797,7 +773,7 @@ function db_add_unique_key($table, $name, $fields) {
  *   The name of the key.
  */
 function db_drop_unique_key($table, $name) {
-  return Database::getConnection()->schema()->dropUniqueKey($table, $name);
+  return drupal_container()->get('database')->schema()->dropUniqueKey($table, $name);
 }
 
 /**
@@ -811,7 +787,7 @@ function db_drop_unique_key($table, $name) {
  *   An array of field names.
  */
 function db_add_index($table, $name, $fields) {
-  return Database::getConnection()->schema()->addIndex($table, $name, $fields);
+  return drupal_container()->get('database')->schema()->addIndex($table, $name, $fields);
 }
 
 /**
@@ -823,7 +799,7 @@ function db_add_index($table, $name, $fields) {
  *   The name of the index.
  */
 function db_drop_index($table, $name) {
-  return Database::getConnection()->schema()->dropIndex($table, $name);
+  return drupal_container()->get('database')->schema()->dropIndex($table, $name);
 }
 
 /**
@@ -887,7 +863,7 @@ function db_drop_index($table, $name) {
  *   but without the 'fields' element.
  */
 function db_change_field($table, $field, $field_new, $spec, $keys_new = array()) {
-  return Database::getConnection()->schema()->changeField($table, $field, $field_new, $spec, $keys_new);
+  return drupal_container()->get('database')->schema()->changeField($table, $field, $field_new, $spec, $keys_new);
 }
 
 /**
@@ -898,7 +874,7 @@ function db_change_field($table, $field, $field_new, $spec, $keys_new = array())
  * Sets a session variable specifying the lag time for ignoring a slave server.
  */
 function db_ignore_slave() {
-  $connection_info = Database::getConnectionInfo();
+  $connection_info = drupal_container()->get('database_manager')->getConnectionInfo();
   // Only set ignore_slave_server if there are slave servers being used, which
   // is assumed if there are more than one.
   if (count($connection_info) > 1) {
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index da39097..e837965 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -931,8 +931,9 @@ function install_verify_completed_task() {
  * Verifies that settings.php specifies a valid database connection.
  */
 function install_verify_database_settings() {
-  global $databases;
-  if (!empty($databases)) {
+  $container = drupal_container();
+  if ($container->hasParameter('database.info')) {
+    $databases = $container->getParameter('database.info');
     $database = $databases['default']['default'];
     drupal_static_reset('conf_path');
     $settings_file = './' . conf_path(FALSE) . '/settings.php';
@@ -955,13 +956,16 @@ function install_verify_database_settings() {
  * @ingroup forms
  */
 function install_settings_form($form, &$form_state, &$install_state) {
-  global $databases;
   $profile = $install_state['parameters']['profile'];
 
   drupal_static_reset('conf_path');
   $conf_path = './' . conf_path(FALSE);
   $settings_file = $conf_path . '/settings.php';
-  $database = isset($databases['default']['default']) ? $databases['default']['default'] : array();
+  $database = array();
+  if (drupal_container()->hasParameter('database.info')) {
+    $databases = drupal_container()->getParameter('database.info');
+    $database = isset($databases['default']['default']) ? $databases['default']['default'] : array();
+  }
 
   drupal_set_title(st('Database configuration'));
 
@@ -1029,6 +1033,7 @@ function install_settings_form_validate($form, &$form_state) {
   unset($database['db_prefix']);
 
   $form_state['storage']['database'] = $database;
+  drupal_container()->setParameter('database.info', array('default' => $database));
   $errors = install_database_errors($database, $form_state['values']['settings_file']);
   foreach ($errors as $name => $message) {
     form_set_error($name, $message);
@@ -1039,7 +1044,6 @@ function install_settings_form_validate($form, &$form_state) {
  * Checks a database connection and returns any errors.
  */
 function install_database_errors($database, $settings_file) {
-  global $databases;
   $errors = array();
 
   // Check database type.
@@ -1054,14 +1058,28 @@ function install_database_errors($database, $settings_file) {
 
     // Run tasks associated with the database type. Any errors are caught in the
     // calling function.
-    $databases['default']['default'] = $database;
     // Just changing the global doesn't get the new information processed.
     // We need to close any active connections and tell the Database class to
     // re-parse $databases.
-    if (Database::isActiveConnection()) {
-      Database::closeConnection();
+    if (!drupal_container()->has('database')) {
+      $container = drupal_container();
+      $container->setParameter('database.info', array('default' => array('default' => $database)));
+      $container->register('database_manager', 'Drupal\Core\Database\Database')
+        ->addArgument('%database.info%');
+
+      $container->register('database', 'Drupal\Core\Database\Connection')
+        ->setFactoryService('database_manager')
+        ->setFactoryMethod('getConnection')
+        ->addArgument('default');
+      $container->register('database.slave', 'Drupal\Core\Database\Connection')
+        ->setFactoryService('database_manager')
+        ->setFactoryMethod('getConnection')
+        ->addArgument('slave');
+    }
+    else {
+      // If there already is a service defined, close the connection first.
+      drupal_container()->get('database_manager')->closeConnection();
     }
-    Database::parseConnectionInfo();
 
     try {
       db_run_tasks($driver);
@@ -1070,7 +1088,8 @@ function install_database_errors($database, $settings_file) {
       // These are generic errors, so we do not have any specific key of the
       // database connection array to attach them to; therefore, we just put
       // them in the error array with standard numeric keys.
-      $errors[$driver . '][0'] = $e->getMessage();
+
+      $errors[$driver . '][0'] = $e->getTraceAsString();
     }
   }
   return $errors;
diff --git a/core/includes/install.inc b/core/includes/install.inc
index db92987..047f5ff 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -944,9 +944,9 @@ function db_run_tasks($driver) {
  * @param $driver
  *   The name of the driver.
  */
-function db_installer_object($driver) {
-  // We cannot use Database::getConnection->getDriverClass() here, because
+function db_installer_object($driver, $database = NULL) {
+  // 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();
+  return new $task_class($database);
 }
diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php
index 9ab6b11..a9592e3 100644
--- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php
+++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\Core\Cache;
 
-use Drupal\Core\Database\Database;
 use Exception;
 
 /**
@@ -28,6 +27,8 @@ class DatabaseBackend implements CacheBackendInterface {
    */
   protected static $tagCache = array();
 
+  protected $connection;
+
   /**
    * Implements Drupal\Core\Cache\CacheBackendInterface::__construct().
    */
@@ -38,6 +39,9 @@ public function __construct($bin) {
       $bin = 'cache_' . $bin;
     }
     $this->bin = $bin;
+    // @todo: Replace this with a injected connection in
+    //   http://drupal.org/node/1764474.
+    $this->connection = drupal_container()->get('database');
   }
 
   /**
@@ -61,7 +65,7 @@ public function getMultiple(&$cids) {
       // is used here only due to the performance overhead we would incur
       // otherwise. When serving an uncached page, the overhead of using
       // ::select() is a much smaller proportion of the request.
-      $result = Database::getConnection()->query('SELECT cid, data, created, expire, serialized, tags, checksum FROM {' . Database::getConnection()->escapeTable($this->bin) . '} WHERE cid IN (:cids)', array(':cids' => $cids));
+      $result = $this->connection->query('SELECT cid, data, created, expire, serialized, tags, checksum FROM {' . $this->connection->escapeTable($this->bin) . '} WHERE cid IN (:cids)', array(':cids' => $cids));
       $cache = array();
       foreach ($result as $item) {
         $item = $this->prepareItem($item);
@@ -134,7 +138,7 @@ public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANEN
     }
 
     try {
-      Database::getConnection()->merge($this->bin)
+      $this->connection->merge($this->bin)
         ->key(array('cid' => $cid))
         ->fields($fields)
         ->execute();
@@ -148,7 +152,7 @@ public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANEN
    * Implements Drupal\Core\Cache\CacheBackendInterface::delete().
    */
   public function delete($cid) {
-    Database::getConnection()->delete($this->bin)
+    $this->connection->delete($this->bin)
       ->condition('cid', $cid)
       ->execute();
   }
@@ -159,7 +163,7 @@ public function delete($cid) {
   public function deleteMultiple(array $cids) {
     // Delete in chunks when a large array is passed.
     do {
-      Database::getConnection()->delete($this->bin)
+      $this->connection->delete($this->bin)
         ->condition('cid', array_splice($cids, 0, 1000), 'IN')
         ->execute();
     }
@@ -170,14 +174,14 @@ public function deleteMultiple(array $cids) {
    * Implements Drupal\Core\Cache\CacheBackendInterface::flush().
    */
   public function flush() {
-    Database::getConnection()->truncate($this->bin)->execute();
+    $this->connection->truncate($this->bin)->execute();
   }
 
   /**
    * Implements Drupal\Core\Cache\CacheBackendInterface::expire().
    */
   public function expire() {
-    Database::getConnection()->delete($this->bin)
+    $this->connection->delete($this->bin)
       ->condition('expire', CacheBackendInterface::CACHE_PERMANENT, '<>')
       ->condition('expire', REQUEST_TIME, '<')
       ->execute();
@@ -240,7 +244,7 @@ protected function flattenTags(array $tags) {
   public function invalidateTags(array $tags) {
     foreach ($this->flattenTags($tags) as $tag) {
       unset(self::$tagCache[$tag]);
-      Database::getConnection()->merge('cache_tags')
+      $this->connection->merge('cache_tags')
         ->key(array('tag' => $tag))
         ->fields(array('invalidations' => 1))
         ->expression('invalidations', 'invalidations + 1')
@@ -271,7 +275,7 @@ protected function checksumTags($tags) {
    }
     if ($query_tags) {
       try {
-        if ($db_tags = Database::getConnection()->query('SELECT tag, invalidations FROM {cache_tags} WHERE tag IN (:tags)', array(':tags' => $query_tags))->fetchAllKeyed()) {
+        if ($db_tags = $this->connection->query('SELECT tag, invalidations FROM {cache_tags} WHERE tag IN (:tags)', array(':tags' => $query_tags))->fetchAllKeyed()) {
           self::$tagCache = array_merge(self::$tagCache, $db_tags);
           $checksum += array_sum($db_tags);
         }
@@ -288,7 +292,7 @@ protected function checksumTags($tags) {
    */
   public function isEmpty() {
     $this->garbageCollection();
-    $query = Database::getConnection()->select($this->bin);
+    $query = $this->connection->select($this->bin);
     $query->addExpression('1');
     $result = $query->range(0, 1)
       ->execute()
diff --git a/core/lib/Drupal/Core/Cache/InstallBackend.php b/core/lib/Drupal/Core/Cache/InstallBackend.php
index e23294a..f7ed4e7 100644
--- a/core/lib/Drupal/Core/Cache/InstallBackend.php
+++ b/core/lib/Drupal/Core/Cache/InstallBackend.php
@@ -34,6 +34,23 @@
 class InstallBackend extends DatabaseBackend {
 
   /**
+   * Overrides Drupal\Core\Cache\DatabaseBackend::__construct().
+   */
+  public function __construct($bin) {
+    // All cache tables should be prefixed with 'cache_', except for the
+    // default 'cache' bin.
+    if ($bin != 'cache') {
+      $bin = 'cache_' . $bin;
+    }
+    $this->bin = $bin;
+    // @todo: Replace this with an injected connection in
+    //   http://drupal.org/node/1764474.
+    if (drupal_container()->has('database')) {
+      $this->connection = drupal_container()->get('database');
+    }
+  }
+
+  /**
    * Overrides Drupal\Core\Cache\DatabaseBackend::get().
    */
   public function get($cid) {
@@ -57,7 +74,7 @@ public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANEN
    */
   public function delete($cid) {
     try {
-      if (class_exists('Drupal\Core\Database\Database')) {
+      if ($this->connection) {
         parent::delete($cid);
       }
     }
@@ -69,7 +86,7 @@ public function delete($cid) {
    */
   public function deleteMultiple(array $cids) {
     try {
-      if (class_exists('Drupal\Core\Database\Database')) {
+      if ($this->connection) {
         parent::deleteMultiple($cids);
       }
     }
@@ -81,7 +98,7 @@ public function deleteMultiple(array $cids) {
    */
   public function invalidateTags(array $tags) {
     try {
-      if (class_exists('Drupal\Core\Database\Database')) {
+      if ($this->connection) {
         parent::invalidateTags($tags);
       }
     }
@@ -93,7 +110,7 @@ public function invalidateTags(array $tags) {
    */
   public function flush() {
     try {
-      if (class_exists('Drupal\Core\Database\Database')) {
+      if ($this->connection) {
         parent::flush();
       }
     }
@@ -105,7 +122,7 @@ public function flush() {
    */
   public function expire() {
     try {
-      if (class_exists('Drupal\Core\Database\Database')) {
+      if ($this->connection) {
         parent::expire();
       }
     }
@@ -117,7 +134,7 @@ public function expire() {
    */
   public function garbageCollection() {
     try {
-      if (class_exists('Drupal\Core\Database\Database')) {
+      if ($this->connection) {
         parent::garbageCollection();
       }
     }
@@ -129,7 +146,7 @@ public function garbageCollection() {
    */
   public function isEmpty() {
     try {
-      if (class_exists('Drupal\Core\Database\Database')) {
+      if ($this->connection) {
         return parent::isEmpty();
       }
     }
diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php
index f1e43d6..89435ad 100644
--- a/core/lib/Drupal/Core/CoreBundle.php
+++ b/core/lib/Drupal/Core/CoreBundle.php
@@ -46,14 +46,6 @@ public function build(ContainerBuilder $container) {
     $container->register('language_manager', 'Drupal\Core\Language\LanguageManager')
       ->addArgument(new Reference('request'))
       ->setScope('request');
-    $container->register('database', 'Drupal\Core\Database\Connection')
-      ->setFactoryClass('Drupal\Core\Database\Database')
-      ->setFactoryMethod('getConnection')
-      ->addArgument('default');
-    $container->register('database.slave', 'Drupal\Core\Database\Connection')
-      ->setFactoryClass('Drupal\Core\Database\Database')
-      ->setFactoryMethod('getConnection')
-      ->addArgument('slave');
     $container->register('typed_data', 'Drupal\Core\TypedData\TypedDataManager');
     // Add the user's storage for temporary, non-cache data.
     $container->register('lock', 'Drupal\Core\Lock\DatabaseLockBackend');
@@ -73,7 +65,7 @@ public function build(ContainerBuilder $container) {
     $matcher->add(new \Drupal\Core\LegacyUrlMatcher());
 
     $nested = new \Drupal\Core\Routing\NestedMatcher();
-    $nested->setInitialMatcher(new \Drupal\Core\Routing\PathMatcher(Database::getConnection()));
+    $nested->setInitialMatcher(new \Drupal\Core\Routing\PathMatcher(drupal_container()->get('database')));
     $nested->addPartialMatcher(new \Drupal\Core\Routing\HttpMethodMatcher());
     $nested->setFinalMatcher(new \Drupal\Core\Routing\FirstEntryFinalMatcher());
     $matcher->add($nested, 5);
diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php
index 1960874..66dd2f6 100644
--- a/core/lib/Drupal/Core/Database/Connection.php
+++ b/core/lib/Drupal/Core/Database/Connection.php
@@ -163,7 +163,7 @@ public function destroy() {
     // Destroy all references to this connection by setting them to NULL.
     // The Statement class attribute only accepts a new value that presents a
     // proper callable, so we reset it to PDOStatement.
-    $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array()));
+    $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array(NULL)));
     $this->schema = NULL;
   }
 
diff --git a/core/lib/Drupal/Core/Database/Database.php b/core/lib/Drupal/Core/Database/Database.php
index 25fe8fa..3b50f8b 100644
--- a/core/lib/Drupal/Core/Database/Database.php
+++ b/core/lib/Drupal/Core/Database/Database.php
@@ -9,12 +9,8 @@
 
 /**
  * Primary front-controller for the database system.
- *
- * This class is uninstantiatable and un-extendable. It acts to encapsulate
- * all control and shepherding of database connections into a single location
- * without the use of globals.
  */
-abstract class Database {
+class Database {
 
   /**
    * Flag to indicate a query call should simply return NULL.
@@ -45,28 +41,28 @@
    *
    * @var array
    */
-  static protected $connections = array();
+  protected $connections = array();
 
   /**
    * A processed copy of the database connection information from settings.php.
    *
    * @var array
    */
-  static protected $databaseInfo = NULL;
+  protected $databaseInfo = NULL;
 
   /**
    * A list of key/target credentials to simply ignore.
    *
    * @var array
    */
-  static protected $ignoreTargets = array();
+  protected $ignoreTargets = array();
 
   /**
    * The key of the currently active database connection.
    *
    * @var string
    */
-  static protected $activeKey = 'default';
+  protected $activeKey = 'default';
 
   /**
    * An array of active query log objects.
@@ -80,7 +76,11 @@
    *
    * @var array
    */
-  static protected $logs = array();
+  protected $logs = array();
+
+  public function __construct(array $database_info) {
+    $this->parseConnectionInfo($database_info);
+  }
 
   /**
    * Starts logging a given logging key on the specified connection.
@@ -97,21 +97,21 @@
    *
    * @see Drupal\Core\Database\Log
    */
-  final public static function startLog($logging_key, $key = 'default') {
-    if (empty(self::$logs[$key])) {
-      self::$logs[$key] = new Log($key);
+  public function startLog($logging_key, $key = 'default') {
+    if (empty($this->logs[$key])) {
+      $this->logs[$key] = new Log($key);
 
       // Every target already active for this connection key needs to have the
       // logging object associated with it.
-      if (!empty(self::$connections[$key])) {
-        foreach (self::$connections[$key] as $connection) {
-          $connection->setLogger(self::$logs[$key]);
+      if (!empty($this->connections[$key])) {
+        foreach ($this->connections[$key] as $connection) {
+          $connection->setLogger($this->logs[$key]);
         }
       }
     }
 
-    self::$logs[$key]->start($logging_key);
-    return self::$logs[$key];
+    $this->logs[$key]->start($logging_key);
+    return $this->logs[$key];
   }
 
   /**
@@ -132,19 +132,19 @@
    *
    * @see Drupal\Core\Database\Log
    */
-  final public static function getLog($logging_key, $key = 'default') {
-    if (empty(self::$logs[$key])) {
+  public function getLog($logging_key, $key = 'default') {
+    if (empty($this->logs[$key])) {
       return NULL;
     }
-    $queries = self::$logs[$key]->get($logging_key);
-    self::$logs[$key]->end($logging_key);
+    $queries = $this->logs[$key]->get($logging_key);
+    $this->logs[$key]->end($logging_key);
     return $queries;
   }
 
   /**
    * Gets the connection object for the specified database key and target.
    *
-   * @param $target
+   * @param string $target
    *   The database target name.
    * @param $key
    *   The database connection key. Defaults to NULL which means the active key.
@@ -152,25 +152,26 @@
    * @return Drupal\Core\Database\Connection
    *   The corresponding connection object.
    */
-  final public static function getConnection($target = 'default', $key = NULL) {
+  public function getConnection($target = 'default', $key = NULL) {
+
     if (!isset($key)) {
       // By default, we want the active connection, set in setActiveConnection.
-      $key = self::$activeKey;
+      $key = $this->activeKey;
     }
     // If the requested target does not exist, or if it is ignored, we fall back
     // to the default target. The target is typically either "default" or
     // "slave", indicating to use a slave SQL server if one is available. If
     // it's not available, then the default/master server is the correct server
     // to use.
-    if (!empty(self::$ignoreTargets[$key][$target]) || !isset(self::$databaseInfo[$key][$target])) {
+    if (!empty($this->ignoreTargets[$key][$target]) || !isset($this->databaseInfo[$key][$target])) {
       $target = 'default';
     }
 
-    if (!isset(self::$connections[$key][$target])) {
+    if (!isset($this->connections[$key][$target])) {
       // If necessary, a new connection is opened.
-      self::$connections[$key][$target] = self::openConnection($key, $target);
+      $this->connections[$key][$target] = self::openConnection($key, $target);
     }
-    return self::$connections[$key][$target];
+    return $this->connections[$key][$target];
   }
 
   /**
@@ -183,8 +184,8 @@
    *   TRUE if there is at least one database connection established, FALSE
    *   otherwise.
    */
-  final public static function isActiveConnection() {
-    return !empty(self::$activeKey) && !empty(self::$connections) && !empty(self::$connections[self::$activeKey]);
+  public function isActiveConnection() {
+    return !empty($this->activeKey) && !empty($this->connections) && !empty($this->connections[$this->activeKey]);
   }
 
   /**
@@ -193,14 +194,10 @@
    * @return
    *   The previous database connection key.
    */
-  final public static function setActiveConnection($key = 'default') {
-    if (empty(self::$databaseInfo)) {
-      self::parseConnectionInfo();
-    }
-
-    if (!empty(self::$databaseInfo[$key])) {
-      $old_key = self::$activeKey;
-      self::$activeKey = $key;
+  public function setActiveConnection($key = 'default') {
+    if (!empty($this->databaseInfo[$key])) {
+      $old_key = $this->activeKey;
+      $this->activeKey = $key;
       return $old_key;
     }
   }
@@ -208,10 +205,7 @@
   /**
    * Process the configuration file for database information.
    */
-  final public static function parseConnectionInfo() {
-    global $databases;
-
-    $database_info = is_array($databases) ? $databases : array();
+  public function parseConnectionInfo($database_info) {
     foreach ($database_info as $index => $info) {
       foreach ($database_info[$index] as $target => $value) {
         // If there is no "driver" property, then we assume it's an array of
@@ -237,8 +231,8 @@
       }
     }
 
-    if (!is_array(self::$databaseInfo)) {
-      self::$databaseInfo = $database_info;
+    if (!is_array($this->databaseInfo)) {
+      $this->databaseInfo = $database_info;
     }
 
     // Merge the new $database_info into the existing.
@@ -247,7 +241,7 @@
     else {
       foreach ($database_info as $database_key => $database_values) {
         foreach ($database_values as $target => $target_values) {
-          self::$databaseInfo[$database_key][$target] = $target_values;
+          $this->databaseInfo[$database_key][$target] = $target_values;
         }
       }
     }
@@ -273,9 +267,9 @@
    *   settings.php. Note that the structure of this array will depend on the
    *   database driver it is connecting to.
    */
-  public static function addConnectionInfo($key, $target, $info) {
-    if (empty(self::$databaseInfo[$key][$target])) {
-      self::$databaseInfo[$key][$target] = $info;
+  public function addConnectionInfo($key, $target, $info) {
+    if (empty($this->databaseInfo[$key][$target])) {
+      $this->databaseInfo[$key][$target] = $info;
     }
   }
 
@@ -285,13 +279,9 @@ public static function addConnectionInfo($key, $target, $info) {
    * @param $connection
    *   The connection key for which we want information.
    */
-  final public static function getConnectionInfo($key = 'default') {
-    if (empty(self::$databaseInfo)) {
-      self::parseConnectionInfo();
-    }
-
-    if (!empty(self::$databaseInfo[$key])) {
-      return self::$databaseInfo[$key];
+  public function getConnectionInfo($key = 'default') {
+    if (!empty($this->databaseInfo[$key])) {
+      return $this->databaseInfo[$key];
     }
   }
 
@@ -305,20 +295,16 @@ public static function addConnectionInfo($key, $target, $info) {
    * @return
    *   TRUE in case of success, FALSE otherwise.
    */
-  final public static function renameConnection($old_key, $new_key) {
-    if (empty(self::$databaseInfo)) {
-      self::parseConnectionInfo();
-    }
-
-    if (!empty(self::$databaseInfo[$old_key]) && empty(self::$databaseInfo[$new_key])) {
+  public function renameConnection($old_key, $new_key) {
+    if (!empty($this->databaseInfo[$old_key]) && empty($this->databaseInfo[$new_key])) {
       // Migrate the database connection information.
-      self::$databaseInfo[$new_key] = self::$databaseInfo[$old_key];
-      unset(self::$databaseInfo[$old_key]);
+      $this->databaseInfo[$new_key] = $this->databaseInfo[$old_key];
+      unset($this->databaseInfo[$old_key]);
 
       // Migrate over the DatabaseConnection object if it exists.
-      if (isset(self::$connections[$old_key])) {
-        self::$connections[$new_key] = self::$connections[$old_key];
-        unset(self::$connections[$old_key]);
+      if (isset($this->connections[$old_key])) {
+        $this->connections[$new_key] = $this->connections[$old_key];
+        unset($this->connections[$old_key]);
       }
 
       return TRUE;
@@ -336,10 +322,10 @@ public static function addConnectionInfo($key, $target, $info) {
    * @return
    *   TRUE in case of success, FALSE otherwise.
    */
-  final public static function removeConnection($key) {
-    if (isset(self::$databaseInfo[$key])) {
+  public function removeConnection($key) {
+    if (isset($this->databaseInfo[$key])) {
       self::closeConnection(NULL, $key);
-      unset(self::$databaseInfo[$key]);
+      unset($this->databaseInfo[$key]);
       return TRUE;
     }
     else {
@@ -359,30 +345,26 @@ public static function addConnectionInfo($key, $target, $info) {
    * @throws Drupal\Core\Database\ConnectionNotDefinedException
    * @throws Drupal\Core\Database\DriverNotSpecifiedException
    */
-  final protected static function openConnection($key, $target) {
-    if (empty(self::$databaseInfo)) {
-      self::parseConnectionInfo();
-    }
-
+  protected function openConnection($key, $target) {
     // If the requested database does not exist then it is an unrecoverable
     // error.
-    if (!isset(self::$databaseInfo[$key])) {
+    if (!isset($this->databaseInfo[$key])) {
       throw new ConnectionNotDefinedException('The specified database connection is not defined: ' . $key);
     }
 
-    if (!$driver = self::$databaseInfo[$key][$target]['driver']) {
+    if (!$driver = $this->databaseInfo[$key][$target]['driver']) {
       throw new DriverNotSpecifiedException('Driver not specified for this database connection: ' . $key);
     }
 
     $driver_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\Connection";
-    $new_connection = new $driver_class(self::$databaseInfo[$key][$target]);
+    $new_connection = new $driver_class($this->databaseInfo[$key][$target]);
     $new_connection->setTarget($target);
     $new_connection->setKey($key);
 
     // If we have any active logging objects for this connection key, we need
     // to associate them with the connection we just opened.
-    if (!empty(self::$logs[$key])) {
-      $new_connection->setLogger(self::$logs[$key]);
+    if (!empty($this->logs[$key])) {
+      $new_connection->setLogger($this->logs[$key]);
     }
 
     return $new_connection;
@@ -397,30 +379,30 @@ public static function addConnectionInfo($key, $target, $info) {
    * @param $key
    *   The database connection key. Defaults to NULL which means the active key.
    */
-  public static function closeConnection($target = NULL, $key = NULL) {
+  public function closeConnection($target = NULL, $key = NULL) {
     // Gets the active connection by default.
     if (!isset($key)) {
-      $key = self::$activeKey;
+      $key = $this->activeKey;
     }
     // To close a connection, it needs to be set to NULL and removed from the
-    // static variable. In all cases, closeConnection() might be called for a
+    // variable. In all cases, closeConnection() might be called for a
     // connection that was not opened yet, in which case the key is not defined
     // yet and we just ensure that the connection key is undefined.
     if (isset($target)) {
-      if (isset(self::$connections[$key][$target])) {
-        self::$connections[$key][$target]->destroy();
-        self::$connections[$key][$target] = NULL;
+      if (isset($this->connections[$key][$target])) {
+        $this->connections[$key][$target]->destroy();
+        $this->connections[$key][$target] = NULL;
       }
-      unset(self::$connections[$key][$target]);
+      unset($this->connections[$key][$target]);
     }
     else {
-      if (isset(self::$connections[$key])) {
-        foreach (self::$connections[$key] as $target => $connection) {
-          self::$connections[$key][$target]->destroy();
-          self::$connections[$key][$target] = NULL;
+      if (isset($this->connections[$key])) {
+        foreach ($this->connections[$key] as $target => $connection) {
+          $this->connections[$key][$target]->destroy();
+          $this->connections[$key][$target] = NULL;
         }
       }
-      unset(self::$connections[$key]);
+      unset($this->connections[$key]);
     }
   }
 
@@ -436,7 +418,16 @@ public static function closeConnection($target = NULL, $key = NULL) {
    * @param $target
    *   The target of the specified key to ignore.
    */
-  public static function ignoreTarget($key, $target) {
-    self::$ignoreTargets[$key][$target] = TRUE;
+  public function ignoreTarget($key, $target) {
+    $this->ignoreTargets[$key][$target] = TRUE;
+  }
+
+  public function __destruct() {
+    if ($this->isActiveConnection()) {
+      // Register this as a shutdown function in __destruct() to make sure this
+      // happens after all other shotdown functions have been executed.
+      register_shutdown_function(array($this, 'closeConnection'));
+      $this->closeConnection();
+    }
   }
 }
diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
index d88633f..8788531 100644
--- a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
@@ -48,7 +48,7 @@ protected function getPrefixInfo($table = 'default', $add_prefix = TRUE) {
       $info['table'] = substr($table, ++$pos);
     }
     else {
-      $db_info = Database::getConnectionInfo();
+      $db_info = drupal_container()->get('database_manager')->getConnectionInfo();
       $info['database'] = $db_info['default']['database'];
       $info['table'] = $table;
     }
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
index 6dc40a2..2ca1270 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
@@ -73,7 +73,7 @@ protected function checkEncoding() {
   function checkBinaryOutput() {
     // PostgreSQL < 9 doesn't support bytea_output, so verify we are running
     // at least PostgreSQL 9.
-    $database_connection = Database::getConnection();
+    $database_connection = drupal_container()->get('database');
     if (version_compare($database_connection->version(), '9') >= 0) {
       if (!$this->checkBinaryOutputSuccess()) {
         // First try to alter the database. If it fails, raise an error telling
diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php
index 5d34a62..d72c744 100644
--- a/core/lib/Drupal/Core/Database/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Install/Tasks.php
@@ -7,8 +7,6 @@
 
 namespace Drupal\Core\Database\Install;
 
-use Drupal\Core\Database\Database;
-
 use PDO;
 use Exception;
 
@@ -160,10 +158,7 @@ public function runTasks() {
    */
   protected function connect() {
     try {
-      // This doesn't actually test the connection.
-      db_set_active();
-      // Now actually do a check.
-      Database::getConnection();
+      drupal_container()->get('database');
       $this->pass('Drupal can CONNECT to the database ok.');
     }
     catch (Exception $e) {
@@ -191,8 +186,8 @@ protected function runTestQuery($query, $pass, $fail, $fatal = FALSE) {
    * Check the engine version.
    */
   protected function checkEngineVersion() {
-    if ($this->minimumVersion() && version_compare(Database::getConnection()->version(), $this->minimumVersion(), '<')) {
-      $this->fail(st("The database version %version is less than the minimum required version %minimum_version.", array('%version' => Database::getConnection()->version(), '%minimum_version' => $this->minimumVersion())));
+    if ($this->minimumVersion() && version_compare(drupal_container()->get('database')->version(), $this->minimumVersion(), '<')) {
+      $this->fail(st("The database version %version is less than the minimum required version %minimum_version.", array('%version' => drupal_container()->get('database')->version(), '%minimum_version' => $this->minimumVersion())));
     }
   }
 
diff --git a/core/lib/Drupal/Core/Database/Query/Query.php b/core/lib/Drupal/Core/Database/Query/Query.php
index 95ab4b9..01128d7 100644
--- a/core/lib/Drupal/Core/Database/Query/Query.php
+++ b/core/lib/Drupal/Core/Database/Query/Query.php
@@ -94,7 +94,7 @@ public function __sleep() {
    * Implements the magic __wakeup function to reconnect to the database.
    */
   public function __wakeup() {
-    $this->connection = Database::getConnection($this->connectionTarget, $this->connectionKey);
+    $this->connection = drupal_container()->get('database_manager')->getConnection($this->connectionTarget, $this->connectionKey);
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Database/Statement.php b/core/lib/Drupal/Core/Database/Statement.php
index c5b1735..dacf90c 100644
--- a/core/lib/Drupal/Core/Database/Statement.php
+++ b/core/lib/Drupal/Core/Database/Statement.php
@@ -50,9 +50,11 @@ public function execute($args = array(), $options = array()) {
       }
     }
 
-    $logger = $this->dbh->getLogger();
-    if (!empty($logger)) {
-      $query_start = microtime(TRUE);
+    if ($this->dbh) {
+      $logger = $this->dbh->getLogger();
+      if (!empty($logger)) {
+        $query_start = microtime(TRUE);
+      }
     }
 
     $return = parent::execute($args);
diff --git a/core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php b/core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php
index 0ce7934..f232414 100644
--- a/core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php
+++ b/core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php
@@ -53,7 +53,7 @@ class DatabaseStorageExpirable extends DatabaseStorage implements KeyValueStoreE
    */
   public function __construct($collection, array $options = array()) {
     parent::__construct($collection, $options);
-    $this->connection = isset($options['connection']) ? $options['connection'] : Database::getConnection();
+    $this->connection = isset($options['connection']) ? $options['connection'] : drupal_container()->get('database');
     $this->table = isset($options['table']) ? $options['table'] : 'key_value_expire';
   }
 
diff --git a/core/lib/Drupal/Core/Routing/MatcherDumper.php b/core/lib/Drupal/Core/Routing/MatcherDumper.php
index 48b2d8c..946a774 100644
--- a/core/lib/Drupal/Core/Routing/MatcherDumper.php
+++ b/core/lib/Drupal/Core/Routing/MatcherDumper.php
@@ -47,7 +47,7 @@ class MatcherDumper implements MatcherDumperInterface {
   /**
    * Construct the MatcherDumper.
    *
-   * @param Drupal\Core\Database\Connection $connection
+   * @param Drupal\Core\Database\Connection $database
    *   The database connection which will be used to store the route
    *   information.
    * @param string $table
diff --git a/core/modules/dblog/dblog.module b/core/modules/dblog/dblog.module
index 2e8422f..28c7746 100644
--- a/core/modules/dblog/dblog.module
+++ b/core/modules/dblog/dblog.module
@@ -146,7 +146,7 @@ function _dblog_get_message_types() {
  * Note: Some values may be truncated to meet database column size restrictions.
  */
 function dblog_watchdog(array $log_entry) {
-  Database::getConnection('default', 'default')->insert('watchdog')
+  drupal_container()->get('database')->insert('watchdog')
     ->fields(array(
       'uid' => $log_entry['uid'],
       'type' => substr($log_entry['type'], 0, 64),
diff --git a/core/modules/field/modules/field_sql_storage/field_sql_storage.module b/core/modules/field/modules/field_sql_storage/field_sql_storage.module
index dcd6ba1..c02279c 100644
--- a/core/modules/field/modules/field_sql_storage/field_sql_storage.module
+++ b/core/modules/field/modules/field_sql_storage/field_sql_storage.module
@@ -258,7 +258,7 @@ function field_sql_storage_field_storage_update_field($field, $prior_field, $has
   if (! $has_data) {
     // There is no data. Re-create the tables completely.
 
-    if (Database::getConnection()->supportsTransactionalDDL()) {
+    if (drupal_container()->get('database')->supportsTransactionalDDL()) {
       // If the database supports transactional DDL, we can go ahead and rely
       // on it. If not, we will have to rollback manually if something fails.
       $transaction = db_transaction();
@@ -275,7 +275,7 @@ function field_sql_storage_field_storage_update_field($field, $prior_field, $has
       }
     }
     catch (Exception $e) {
-      if (Database::getConnection()->supportsTransactionalDDL()) {
+      if (drupal_container()->get('database')->supportsTransactionalDDL()) {
         $transaction->rollback();
       }
       else {
diff --git a/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php b/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
index 3cabd58..8b58649 100644
--- a/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
+++ b/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
@@ -362,8 +362,8 @@ function testFieldUpdateIndexesWithData() {
 
     // Verify the indexes we will create do not exist yet.
     foreach ($tables as $table) {
-      $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value'), t("No index named value exists in $table"));
-      $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value_format'), t("No index named value_format exists in $table"));
+      $this->assertFalse(drupal_container()->get('database')->schema()->indexExists($table, 'value'), t("No index named value exists in $table"));
+      $this->assertFalse(drupal_container()->get('database')->schema()->indexExists($table, 'value_format'), t("No index named value_format exists in $table"));
     }
 
     // Add data so the table cannot be dropped.
@@ -375,15 +375,15 @@ function testFieldUpdateIndexesWithData() {
     $field = array('field_name' => $field_name, 'indexes' => array('value' => array(array('value', 255))));
     field_update_field($field);
     foreach ($tables as $table) {
-      $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value created in $table"));
+      $this->assertTrue(drupal_container()->get('database')->schema()->indexExists($table, "{$field_name}_value"), t("Index on value created in $table"));
     }
 
     // Add a different index, removing the existing custom one.
     $field = array('field_name' => $field_name, 'indexes' => array('value_format' => array(array('value', 127), array('format', 127))));
     field_update_field($field);
     foreach ($tables as $table) {
-      $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value_format"), t("Index on value_format created in $table"));
-      $this->assertFalse(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value removed in $table"));
+      $this->assertTrue(drupal_container()->get('database')->schema()->indexExists($table, "{$field_name}_value_format"), t("Index on value_format created in $table"));
+      $this->assertFalse(drupal_container()->get('database')->schema()->indexExists($table, "{$field_name}_value"), t("Index on value removed in $table"));
     }
 
     // Verify that the tables were not dropped.
diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module
index 3d3ce1f..4b5ecb6 100644
--- a/core/modules/locale/locale.module
+++ b/core/modules/locale/locale.module
@@ -357,8 +357,7 @@ function locale_reset() {
 function locale_storage() {
   $storage = &drupal_static(__FUNCTION__);
   if (!isset($storage)) {
-    $options = array('target' => 'default');
-    $storage = new StringDatabaseStorage(Database::getConnection($options['target']), $options);
+    $storage = new StringDatabaseStorage(drupal_container()->get('database'));
   }
   return $storage;
 }
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
index 285e616..f8b1c5a 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
@@ -76,7 +76,7 @@ function testFailedPageCreation() {
       $this->pass(t('Expected exception has been thrown.'));
     }
 
-    if (Database::getConnection()->supportsTransactions()) {
+    if (drupal_container()->get('database')->supportsTransactions()) {
       // Check that the node does not exist in the database.
       $node = $this->drupalGetNodeByTitle($edit['title']);
       $this->assertFalse($node, 'Transactions supported, and node not found in database.');
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index dc6dae4..9ba31bb 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -136,6 +136,8 @@
    */
   protected $verboseDirectoryUrl;
 
+  protected static $originalContainer;
+
   /**
    * Constructor for Test.
    *
@@ -289,15 +291,12 @@ public static function deleteAssert($message_id) {
    *   The database connection to use for inserting assertions.
    */
   public static function getDatabaseConnection() {
-    try {
-      $connection = Database::getConnection('default', 'simpletest_original_default');
+    if (!empty(self::$originalContainer)) {
+      return self::$originalContainer->get('database');
     }
-    catch (ConnectionNotDefinedException $e) {
-      // If the test was not set up, the simpletest_original_default
-      // connection does not exist.
-      $connection = Database::getConnection('default', 'default');
+    else {
+      return drupal_container()->get('database');
     }
-    return $connection;
   }
 
   /**
@@ -766,22 +765,15 @@ protected function changeDatabasePrefix() {
     }
 
     // Clone the current connection and replace the current prefix.
-    $connection_info = Database::getConnectionInfo('default');
-    Database::renameConnection('default', 'simpletest_original_default');
-    foreach ($connection_info as $target => $value) {
-      $connection_info[$target]['prefix'] = array(
-        'default' => $value['prefix']['default'] . $this->databasePrefix,
+    $database_info = self::$originalContainer->getParameter('database.info');
+    foreach ($database_info['default'] as $target => $value) {
+      $prefix = is_string($value['prefix']) ? $value['prefix'] : $value['prefix']['default'];
+      $database_info['default'][$target]['prefix'] = array(
+        'default' => $prefix . $this->databasePrefix,
       );
     }
-    Database::addConnectionInfo('default', 'default', $connection_info['default']);
 
-    // Additionally override global $databases, since the installer does not use
-    // the Database connection info.
-    // @see install_verify_database_settings()
-    // @see install_database_errors()
-    // @todo Fix installer to use Database connection info.
-    global $databases;
-    $databases['default']['default'] = $connection_info['default'];
+    $this->container->setParameter('database.info', $database_info);
 
     // Indicate the database prefix was set up correctly.
     $this->setupDatabasePrefix = TRUE;
@@ -814,7 +806,7 @@ protected function prepareEnvironment() {
     $this->originalConf = $conf;
 
     // Backup statics and globals.
-    $this->originalContainer = clone drupal_container();
+    self::$originalContainer = clone drupal_container();
     $this->originalLanguage = $language_interface;
     $this->originalConfigDirectories = $GLOBALS['config_directories'];
     $this->originalThemeKey = $GLOBALS['theme_key'];
@@ -912,15 +904,22 @@ protected function rebuildContainer() {
     // restores the original container.
     // @see Drupal\Core\DrupalKernel::initializeContainer()
     $this->kernel = new DrupalKernel('testing', FALSE);
+
+    // The DrupalKernel does not update the container in drupal_container(), but
+    // replaces it with a new object. We therefore need to replace the minimal
+    // boostrap container that has been set up by TestBase::prepareEnvironment().
+    $this->container = drupal_container();
+
+    // The database prefix is stored as a container parameter, rebuilding the
+    // container means those params are gone, so this step needs to be repeated
+    // every time the container is rebuilt.
+    $this->changeDatabasePrefix();
+
     // Booting the kernel is necessary to initialize the new DIC. While
     // normally the kernel gets booted on demand in
     // Symfony\Component\HttpKernel\handle(), this kernel needs manual booting
     // as it is not used to handle a request.
     $this->kernel->boot();
-    // The DrupalKernel does not update the container in drupal_container(), but
-    // replaces it with a new object. We therefore need to replace the minimal
-    // boostrap container that has been set up by TestBase::prepareEnvironment().
-    $this->container = drupal_container();
   }
 
   /**
@@ -947,9 +946,9 @@ protected function tearDown() {
     // entire parent site otherwise.
     if ($this->setupDatabasePrefix) {
       // Remove all prefixed tables.
-      $connection_info = Database::getConnectionInfo('default');
-      $tables = db_find_tables($connection_info['default']['prefix']['default'] . '%');
-      $prefix_length = strlen($connection_info['default']['prefix']['default']);
+      $database_info = $this->container->getParameter('database.info');
+      $tables = db_find_tables($database_info['default']['default']['prefix']['default'] . '%');
+      $prefix_length = strlen($database_info['default']['default']['prefix']['default']);
       foreach ($tables as $table) {
         if (db_drop_table(substr($table, $prefix_length))) {
           unset($tables[$table]);
@@ -973,18 +972,14 @@ protected function tearDown() {
     // Delete temporary files directory.
     file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10), array($this, 'filePreDeleteCallback'));
 
-    // Restore original database connection.
-    Database::removeConnection('default');
-    Database::renameConnection('simpletest_original_default', 'default');
-    // @see TestBase::changeDatabasePrefix()
-    global $databases;
-    $connection_info = Database::getConnectionInfo('default');
-    $databases['default']['default'] = $connection_info['default'];
+    // Restore the original container.
+    drupal_container(self::$originalContainer);
 
     // Restore original globals.
     $GLOBALS['theme_key'] = $this->originalThemeKey;
     $GLOBALS['theme'] = $this->originalTheme;
 
+
     // Reset all static variables.
     // All destructors of statically cached objects have been invoked above;
     // this second reset is guranteed to reset everything to nothing.
@@ -1001,7 +996,6 @@ protected function tearDown() {
     $conf = $this->originalConf;
 
     // Restore original statics and globals.
-    drupal_container($this->originalContainer);
     $GLOBALS['config_directories'] = $this->originalConfigDirectories;
     if (isset($this->originalPrefix)) {
       drupal_valid_test_ua($this->originalPrefix);
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php
index 98ed71d..e0e9e8a 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php
@@ -7,9 +7,6 @@
 
 namespace Drupal\simpletest;
 
-use Drupal\Core\Database\Database;
-use Drupal\Core\Database\ConnectionNotDefinedException;
-
 /**
  * Test case for Drupal unit tests.
  *
@@ -41,21 +38,13 @@ protected function setUp() {
     // Create the database prefix for this test.
     $this->prepareDatabasePrefix();
 
+    $this->originalThemeRegistry = theme_get_registry(FALSE);
+
     // Prepare the environment for running tests.
     $this->prepareEnvironment();
     if (!$this->setupEnvironment) {
       return FALSE;
     }
-    $this->originalThemeRegistry = theme_get_registry(FALSE);
-
-    // Reset all statics and variables to perform tests in a clean environment.
-    $conf = array();
-    drupal_static_reset();
-
-    // Enforce an empty module list.
-    module_list(NULL, array());
-
-    $conf['file_public_path'] = $this->public_files_directory;
 
     // Change the database prefix.
     // All static variables need to be reset before the database prefix is
@@ -66,6 +55,15 @@ protected function setUp() {
       return FALSE;
     }
 
+    // Reset all statics and variables to perform tests in a clean environment.
+    $conf = array();
+    drupal_static_reset();
+
+    // Enforce an empty module list.
+    module_list(NULL, array());
+
+    $conf['file_public_path'] = $this->public_files_directory;
+
     // Set user agent to be consistent with WebTestBase.
     $_SERVER['HTTP_USER_AGENT'] = $this->databasePrefix;
 
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index c5dbd0b..d44b90e 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -632,7 +632,8 @@ protected function setUp() {
 
     // Set installer parameters.
     // @see install.php, install.core.inc
-    $connection_info = Database::getConnectionInfo();
+    $database_info = $this->container->getParameter('database.info');
+    $connection_info = $database_info['default'];
     $this->root_user = (object) array(
       'name' => 'admin',
       'mail' => 'admin@example.com',
diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index 2388601..8549281 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -443,7 +443,7 @@ function simpletest_clean_environment() {
  * Removed prefixed tables from the database that are left over from crashed tests.
  */
 function simpletest_clean_database() {
-  $tables = db_find_tables(Database::getConnection()->prefixTables('{simpletest}') . '%');
+  $tables = db_find_tables(drupal_container()->get('database')->prefixTables('{simpletest}') . '%');
   $schema = drupal_get_schema_unprocessed('simpletest');
   $count = 0;
   foreach (array_diff_key($tables, $schema) as $table) {
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/SchemaTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/SchemaTest.php
index 7c328b4..e3d9f9d 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/SchemaTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/SchemaTest.php
@@ -74,19 +74,19 @@ function testSchema() {
     $this->assertFalse($this->tryInsert(), 'Insert without a default failed.');
 
     // Test for fake index and test for the boolean result of indexExists().
-    $index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field');
+    $index_exists = drupal_container()->get('database')->schema()->indexExists('test_table', 'test_field');
     $this->assertIdentical($index_exists, FALSE, 'Fake index does not exists');
     // Add index.
     db_add_index('test_table', 'test_field', array('test_field'));
     // Test for created index and test for the boolean result of indexExists().
-    $index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field');
+    $index_exists = drupal_container()->get('database')->schema()->indexExists('test_table', 'test_field');
     $this->assertIdentical($index_exists, TRUE, 'Index created.');
 
     // Rename the table.
     db_rename_table('test_table', 'test_table2');
 
     // Index should be renamed.
-    $index_exists = Database::getConnection()->schema()->indexExists('test_table2', 'test_field');
+    $index_exists = drupal_container()->get('database')->schema()->indexExists('test_table2', 'test_field');
     $this->assertTrue($index_exists, 'Index was renamed.');
 
     // We need the default so that we can insert after the rename.
@@ -177,8 +177,8 @@ function tryInsert($table = 'test_table') {
    *   Optional column to test.
    */
   function checkSchemaComment($description, $table, $column = NULL) {
-    if (method_exists(Database::getConnection()->schema(), 'getComment')) {
-      $comment = Database::getConnection()->schema()->getComment($table, $column);
+    if (method_exists(drupal_container()->get('database')->schema(), 'getComment')) {
+      $comment = drupal_container()->get('database')->schema()->getComment($table, $column);
       $this->assertEqual($comment, $description, 'The comment matches the schema description.');
     }
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionTest.php
index 8bdc45e..5c8a337 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionTest.php
@@ -29,30 +29,31 @@ function testConnectionRouting() {
     // Clone the master credentials to a slave connection.
     // Note this will result in two independent connection objects that happen
     // to point to the same place.
-    $connection_info = Database::getConnectionInfo('default');
-    Database::addConnectionInfo('default', 'slave', $connection_info['default']);
+    $database = drupal_container()->get('database_manager');
+    $connection_info = $database->getConnectionInfo('default');
+    $database->addConnectionInfo('default', 'slave', $connection_info['default']);
 
-    $db1 = Database::getConnection('default', 'default');
-    $db2 = Database::getConnection('slave', 'default');
+    $db1 = $database->getConnection('default', 'default');
+    $db2 = $database->getConnection('slave', 'default');
 
     $this->assertNotNull($db1, 'default connection is a real connection object.');
     $this->assertNotNull($db2, 'slave connection is a real connection object.');
     $this->assertNotIdentical($db1, $db2, 'Each target refers to a different connection.');
 
     // Try to open those targets another time, that should return the same objects.
-    $db1b = Database::getConnection('default', 'default');
-    $db2b = Database::getConnection('slave', 'default');
+    $db1b = $database->getConnection('default', 'default');
+    $db2b = $database->getConnection('slave', 'default');
     $this->assertIdentical($db1, $db1b, 'A second call to getConnection() returns the same object.');
     $this->assertIdentical($db2, $db2b, 'A second call to getConnection() returns the same object.');
 
     // Try to open an unknown target.
     $unknown_target = $this->randomName();
-    $db3 = Database::getConnection($unknown_target, 'default');
+    $db3 = $database->getConnection($unknown_target, 'default');
     $this->assertNotNull($db3, 'Opening an unknown target returns a real connection object.');
     $this->assertIdentical($db1, $db3, 'An unknown target opens the default connection.');
 
     // Try to open that unknown target another time, that should return the same object.
-    $db3b = Database::getConnection($unknown_target, 'default');
+    $db3b = $database->getConnection($unknown_target, 'default');
     $this->assertIdentical($db3, $db3b, 'A second call to getConnection() returns the same object.');
   }
 
@@ -63,13 +64,14 @@ function testConnectionRoutingOverride() {
     // Clone the master credentials to a slave connection.
     // Note this will result in two independent connection objects that happen
     // to point to the same place.
-    $connection_info = Database::getConnectionInfo('default');
-    Database::addConnectionInfo('default', 'slave', $connection_info['default']);
+    $database = drupal_container()->get('database_manager');
+    $connection_info = $database->getConnectionInfo('default');
+    $database->addConnectionInfo('default', 'slave', $connection_info['default']);
 
-    Database::ignoreTarget('default', 'slave');
+    $database->ignoreTarget('default', 'slave');
 
-    $db1 = Database::getConnection('default', 'default');
-    $db2 = Database::getConnection('slave', 'default');
+    $db1 = $database->getConnection('default', 'default');
+    $db2 = $database->getConnection('slave', 'default');
 
     $this->assertIdentical($db1, $db2, 'Both targets refer to the same connection.');
   }
@@ -78,12 +80,13 @@ function testConnectionRoutingOverride() {
    * Tests the closing of a database connection.
    */
   function testConnectionClosing() {
+    $database = drupal_container()->get('database_manager');
     // Open the default target so we have an object to compare.
-    $db1 = Database::getConnection('default', 'default');
+    $db1 = $database->getConnection('default', 'default');
 
     // Try to close the the default connection, then open a new one.
-    Database::closeConnection('default', 'default');
-    $db2 = Database::getConnection('default', 'default');
+    $database->closeConnection('default', 'default');
+    $db2 = $database->getConnection('default', 'default');
 
     // Opening a connection after closing it should yield an object different than the original.
     $this->assertNotIdentical($db1, $db2, 'Opening the default connection after it is closed returns a new object.');
@@ -93,10 +96,11 @@ function testConnectionClosing() {
    * Tests the connection options of the active database.
    */
   function testConnectionOptions() {
-    $connection_info = Database::getConnectionInfo('default');
+    $database = drupal_container()->get('database_manager');
+    $connection_info = $database->getConnectionInfo('default');
 
     // Be sure we're connected to the default database.
-    $db = Database::getConnection('default', 'default');
+    $db = $database->getConnection('default', 'default');
     $connectionOptions = $db->getConnectionOptions();
 
     // In the MySQL driver, the port can be different, so check individual
@@ -105,8 +109,8 @@ function testConnectionOptions() {
     $this->assertEqual($connection_info['default']['database'], $connectionOptions['database'], 'The default connection info database matches the current connection options database.');
 
     // Set up identical slave and confirm connection options are identical.
-    Database::addConnectionInfo('default', 'slave', $connection_info['default']);
-    $db2 = Database::getConnection('slave', 'default');
+    $database->addConnectionInfo('default', 'slave', $connection_info['default']);
+    $db2 = $database->getConnection('slave', 'default');
     $connectionOptions2 = $db2->getConnectionOptions();
 
     // Get a fresh copy of the default connection options.
@@ -116,8 +120,8 @@ function testConnectionOptions() {
     // Set up a new connection with different connection info.
     $test = $connection_info['default'];
     $test['database'] .= 'test';
-    Database::addConnectionInfo('test', 'default', $test);
-    $connection_info = Database::getConnectionInfo('test');
+    $database->addConnectionInfo('test', 'default', $test);
+    $connection_info = $database->getConnectionInfo('test');
 
     // Get a fresh copy of the default connection options.
     $connectionOptions = $db->getConnectionOptions();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionUnitTest.php
index 522a60f..cb82947 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionUnitTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionUnitTest.php
@@ -21,6 +21,8 @@ class ConnectionUnitTest extends UnitTestBase {
   protected $monitor;
   protected $originalCount;
 
+  protected $database;
+
   public static function getInfo() {
     return array(
       'name' => 'Connection unit tests',
@@ -35,15 +37,14 @@ function setUp() {
     $this->key = 'default';
     $this->originalTarget = 'default';
     $this->target = 'DatabaseConnectionUnitTest';
+    $this->database = drupal_container()->get('database_manager');
 
     // Create an additional connection to monitor the connections being opened
     // and closed in this test.
     // @see TestBase::changeDatabasePrefix()
-    $connection_info = Database::getConnectionInfo('default');
-    Database::addConnectionInfo('default', 'monitor', $connection_info['default']);
-    global $databases;
-    $databases['default']['monitor'] = $connection_info['default'];
-    $this->monitor = Database::getConnection('monitor');
+    $connection_info = $this->database->getConnectionInfo('default');
+    $this->database->addConnectionInfo('default', 'monitor', $connection_info['default']);
+    $this->monitor = $this->database->getConnection('monitor');
   }
 
   /**
@@ -51,11 +52,11 @@ function setUp() {
    */
   protected function addConnection() {
     // Add a new target to the connection, by cloning the current connection.
-    $connection_info = Database::getConnectionInfo($this->key);
-    Database::addConnectionInfo($this->key, $this->target, $connection_info[$this->originalTarget]);
+    $connection_info = $this->database->getConnectionInfo($this->key);
+    $this->database->addConnectionInfo($this->key, $this->target, $connection_info[$this->originalTarget]);
 
     // Verify that the new target exists.
-    $info = Database::getConnectionInfo($this->key);
+    $info = $this->database->getConnectionInfo($this->key);
     // Note: Custom assertion message to not expose database credentials.
     $this->assertIdentical($info[$this->target], $connection_info[$this->key], 'New connection info found.');
   }
@@ -66,7 +67,7 @@ protected function addConnection() {
    * @return integer
    */
   protected function getConnectionID() {
-    return (int) Database::getConnection($this->target, $this->key)->query('SELECT CONNECTION_ID()')->fetchField();
+    return (int) $this->database->getConnection($this->target, $this->key)->query('SELECT CONNECTION_ID()')->fetchField();
   }
 
   /**
@@ -100,13 +101,13 @@ function testOpenClose() {
     // Add and open a new connection.
     $this->addConnection();
     $id = $this->getConnectionID();
-    Database::getConnection($this->target, $this->key);
+    $this->database->getConnection($this->target, $this->key);
 
     // Verify that there is a new connection.
     $this->assertConnection($id);
 
     // Close the connection.
-    Database::closeConnection($this->target, $this->key);
+    $this->database->closeConnection($this->target, $this->key);
     // Wait 20ms to give the database engine sufficient time to react.
     usleep(20000);
 
@@ -121,16 +122,16 @@ function testOpenQueryClose() {
     // Add and open a new connection.
     $this->addConnection();
     $id = $this->getConnectionID();
-    Database::getConnection($this->target, $this->key);
+    $this->database->getConnection($this->target, $this->key);
 
     // Verify that there is a new connection.
     $this->assertConnection($id);
 
     // Execute a query.
-    Database::getConnection($this->target, $this->key)->query('SHOW TABLES');
+    $this->database->getConnection($this->target, $this->key)->query('SHOW TABLES');
 
     // Close the connection.
-    Database::closeConnection($this->target, $this->key);
+    $this->database->closeConnection($this->target, $this->key);
     // Wait 20ms to give the database engine sufficient time to react.
     usleep(20000);
 
@@ -145,16 +146,16 @@ function testOpenQueryPrefetchClose() {
     // Add and open a new connection.
     $this->addConnection();
     $id = $this->getConnectionID();
-    Database::getConnection($this->target, $this->key);
+    $this->database->getConnection($this->target, $this->key);
 
     // Verify that there is a new connection.
     $this->assertConnection($id);
 
     // Execute a query.
-    Database::getConnection($this->target, $this->key)->query('SHOW TABLES')->fetchCol();
+    $this->database->getConnection($this->target, $this->key)->query('SHOW TABLES')->fetchCol();
 
     // Close the connection.
-    Database::closeConnection($this->target, $this->key);
+    $this->database->closeConnection($this->target, $this->key);
     // Wait 20ms to give the database engine sufficient time to react.
     usleep(20000);
 
@@ -169,14 +170,14 @@ function testOpenSelectQueryClose() {
     // Add and open a new connection.
     $this->addConnection();
     $id = $this->getConnectionID();
-    Database::getConnection($this->target, $this->key);
+    $this->database->getConnection($this->target, $this->key);
 
     // Verify that there is a new connection.
     $this->assertConnection($id);
 
     // Create a table.
     $name = 'foo';
-    Database::getConnection($this->target, $this->key)->schema()->createTable($name, array(
+    $this->database->getConnection($this->target, $this->key)->schema()->createTable($name, array(
       'fields' => array(
         'name' => array(
           'type' => 'varchar',
@@ -186,16 +187,16 @@ function testOpenSelectQueryClose() {
     ));
 
     // Execute a query.
-    Database::getConnection($this->target, $this->key)->select('foo', 'f')
+    $this->database->getConnection($this->target, $this->key)->select('foo', 'f')
       ->fields('f', array('name'))
       ->execute()
       ->fetchAll();
 
     // Drop the table.
-    Database::getConnection($this->target, $this->key)->schema()->dropTable($name);
+    $this->database->getConnection($this->target, $this->key)->schema()->dropTable($name);
 
     // Close the connection.
-    Database::closeConnection($this->target, $this->key);
+    $this->database->closeConnection($this->target, $this->key);
     // Wait 20ms to give the database engine sufficient time to react.
     usleep(20000);
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/InvalidDataTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/InvalidDataTest.php
index 90a9e18..92504d6 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/InvalidDataTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/InvalidDataTest.php
@@ -51,7 +51,7 @@ function testInsertDuplicateData() {
       $name = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 63))->fetchField();
 
       if ($name == 'Elvis') {
-        if (!Database::getConnection()->supportsTransactions()) {
+        if (!drupal_container()->get('database')->supportsTransactions()) {
           // This is an expected fail.
           // Database engines that don't support transactions can leave partial
           // inserts in place when an error occurs. This is the case for MySQL
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/LoggingTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/LoggingTest.php
index ad3c3c8..3d1c2d9 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/LoggingTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/LoggingTest.php
@@ -26,7 +26,8 @@ public static function getInfo() {
    * Tests that we can log the existence of a query.
    */
   function testEnableLogging() {
-    $log = Database::startLog('testing');
+    $database = drupal_container()->get('database_manager');
+    $log = $database->startLog('testing');
 
     db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25))->fetchCol();
     db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetchCol();
@@ -34,7 +35,7 @@ function testEnableLogging() {
     // Trigger a call that does not have file in the backtrace.
     call_user_func_array('db_query', array('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo')))->fetchCol();
 
-    $queries = Database::getLog('testing', 'default');
+    $queries = $database->getLog('testing', 'default');
 
     $this->assertEqual(count($queries), 3, 'Correct number of queries recorded.');
 
@@ -47,16 +48,17 @@ function testEnableLogging() {
    * Tests that we can run two logs in parallel.
    */
   function testEnableMultiLogging() {
-    Database::startLog('testing1');
+    $database = drupal_container()->get('database_manager');
+    $database->startLog('testing1');
 
     db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25))->fetchCol();
 
-    Database::startLog('testing2');
+    $database->startLog('testing2');
 
     db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetchCol();
 
-    $queries1 = Database::getLog('testing1');
-    $queries2 = Database::getLog('testing2');
+    $queries1 = $database->getLog('testing1');
+    $queries2 = $database->getLog('testing2');
 
     $this->assertEqual(count($queries1), 2, 'Correct number of queries recorded for log 1.');
     $this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for log 2.');
@@ -68,16 +70,17 @@ function testEnableMultiLogging() {
   function testEnableTargetLogging() {
     // Clone the master credentials to a slave connection and to another fake
     // connection.
-    $connection_info = Database::getConnectionInfo('default');
-    Database::addConnectionInfo('default', 'slave', $connection_info['default']);
+    $database = drupal_container()->get('database_manager');
+    $connection_info = $database->getConnectionInfo('default');
+    $database->addConnectionInfo('default', 'slave', $connection_info['default']);
 
-    Database::startLog('testing1');
+    $database->startLog('testing1');
 
     db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25))->fetchCol();
 
     db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'), array('target' => 'slave'));//->fetchCol();
 
-    $queries1 = Database::getLog('testing1');
+    $queries1 = $database->getLog('testing1');
 
     $this->assertEqual(count($queries1), 2, 'Recorded queries from all targets.');
     $this->assertEqual($queries1[0]['target'], 'default', 'First query used default target.');
@@ -92,7 +95,8 @@ function testEnableTargetLogging() {
    * target.
    */
   function testEnableTargetLoggingNoTarget() {
-    Database::startLog('testing1');
+    $database = drupal_container()->get('database_manager');
+    $database->startLog('testing1');
 
     db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25))->fetchCol();
 
@@ -103,7 +107,7 @@ function testEnableTargetLoggingNoTarget() {
     // does not exist.
     db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'), array('target' => 'fake'))->fetchCol();
 
-    $queries1 = Database::getLog('testing1');
+    $queries1 = $database->getLog('testing1');
 
     $this->assertEqual(count($queries1), 2, 'Recorded queries from all targets.');
     $this->assertEqual($queries1[0]['target'], 'default', 'First query used default target.');
@@ -114,13 +118,14 @@ function testEnableTargetLoggingNoTarget() {
    * Tests that we can log queries separately on different connections.
    */
   function testEnableMultiConnectionLogging() {
+    $database = drupal_container()->get('database_manager');
     // Clone the master credentials to a fake connection.
     // That both connections point to the same physical database is irrelevant.
-    $connection_info = Database::getConnectionInfo('default');
-    Database::addConnectionInfo('test2', 'default', $connection_info['default']);
+    $connection_info = $database->getConnectionInfo('default');
+    $database->addConnectionInfo('test2', 'default', $connection_info['default']);
 
-    Database::startLog('testing1');
-    Database::startLog('testing1', 'test2');
+    $database->startLog('testing1');
+    $database->startLog('testing1', 'test2');
 
     db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25))->fetchCol();
 
@@ -130,8 +135,8 @@ function testEnableMultiConnectionLogging() {
 
     db_set_active($old_key);
 
-    $queries1 = Database::getLog('testing1');
-    $queries2 = Database::getLog('testing1', 'test2');
+    $queries1 = $database->getLog('testing1');
+    $queries2 = $database->getLog('testing1', 'test2');
 
     $this->assertEqual(count($queries1), 1, 'Correct number of queries recorded for first connection.');
     $this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for second connection.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/TransactionTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/TransactionTest.php
index 4d5ecf1..f756dc9 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/TransactionTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/TransactionTest.php
@@ -66,7 +66,7 @@ public static function getInfo() {
    *   Whether to execute a DDL statement during the inner transaction.
    */
   protected function transactionOuterLayer($suffix, $rollback = FALSE, $ddl_statement = FALSE) {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $depth = $connection->transactionDepth();
     $txn = db_transaction();
 
@@ -108,7 +108,7 @@ protected function transactionOuterLayer($suffix, $rollback = FALSE, $ddl_statem
    *   Whether to execute a DDL statement during the transaction.
    */
   protected function transactionInnerLayer($suffix, $rollback = FALSE, $ddl_statement = FALSE) {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
 
     $depth = $connection->transactionDepth();
     // Start a transaction. If we're being called from ->transactionOuterLayer,
@@ -162,7 +162,7 @@ protected function transactionInnerLayer($suffix, $rollback = FALSE, $ddl_statem
    */
   function testTransactionRollBackSupported() {
     // This test won't work right if transactions are not supported.
-    if (!Database::getConnection()->supportsTransactions()) {
+    if (!drupal_container()->get('database')->supportsTransactions()) {
       return;
     }
     try {
@@ -188,7 +188,7 @@ function testTransactionRollBackSupported() {
    */
   function testTransactionRollBackNotSupported() {
     // This test won't work right if transactions are supported.
-    if (Database::getConnection()->supportsTransactions()) {
+    if (drupal_container()->get('database')->supportsTransactions()) {
       return;
     }
     try {
@@ -274,7 +274,7 @@ function testTransactionWithDdlStatement() {
     $this->assertRowAbsent('row');
 
     // The behavior of a rollback depends on the type of database server.
-    if (Database::getConnection()->supportsTransactionalDDL()) {
+    if (drupal_container()->get('database')->supportsTransactionalDDL()) {
       // For database servers that support transactional DDL, a rollback
       // of a transaction including DDL statements should be possible.
       $this->cleanUp();
@@ -394,11 +394,11 @@ function assertRowAbsent($name, $message = NULL) {
    */
   function testTransactionStacking() {
     // This test won't work right if transactions are not supported.
-    if (!Database::getConnection()->supportsTransactions()) {
+    if (!drupal_container()->get('database')->supportsTransactions()) {
       return;
     }
 
-    $database = Database::getConnection();
+    $database = drupal_container()->get('database');
 
     // Standard case: pop the inner transaction before the outer transaction.
     $transaction = db_transaction();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleTestBase.php
index f23204b..00fcb61 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleTestBase.php
@@ -42,7 +42,7 @@ function setUp() {
    *   specified base table. Defaults to TRUE.
    */
   function assertTableCount($base_table, $count = TRUE) {
-    $tables = db_find_tables(Database::getConnection()->prefixTables('{' . $base_table . '}') . '%');
+    $tables = db_find_tables(drupal_container()->get('database')->prefixTables('{' . $base_table . '}') . '%');
 
     if ($count) {
       return $this->assertTrue($tables, format_string('Tables matching "@base_table" found.', array('@base_table' => $base_table)));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Routing/MatcherDumperTest.php b/core/modules/system/lib/Drupal/system/Tests/Routing/MatcherDumperTest.php
index 7f6f312..0c707da 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Routing/MatcherDumperTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Routing/MatcherDumperTest.php
@@ -48,7 +48,7 @@ function setUp() {
    * Confirms that the dumper can be instantiated successfuly.
    */
   function testCreate() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $dumper= new MatcherDumper($connection);
 
     $class_name = 'Drupal\Core\Routing\MatcherDumper';
@@ -59,7 +59,7 @@ function testCreate() {
    * Confirms that we can add routes to the dumper.
    */
   function testAddRoutes() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $dumper= new MatcherDumper($connection);
 
     $route = new Route('test');
@@ -80,7 +80,7 @@ function testAddRoutes() {
    * Confirms that we can add routes to the dumper when it already has some.
    */
   function testAddAdditionalRoutes() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $dumper= new MatcherDumper($connection);
 
     $route = new Route('test');
@@ -116,7 +116,7 @@ function testAddAdditionalRoutes() {
    * Confirm that we can dump a route collection to the database.
    */
   public function testDump() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $dumper= new MatcherDumper($connection, 'test_routes');
 
     $route = new Route('/test/{my}/path');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Routing/PathMatcherTest.php b/core/modules/system/lib/Drupal/system/Tests/Routing/PathMatcherTest.php
index 0780250..3c843f3 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Routing/PathMatcherTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Routing/PathMatcherTest.php
@@ -46,7 +46,7 @@ function __construct($test_id = NULL) {
   }
 
   public function tearDown() {
-    $this->fixtures->dropTables(Database::getConnection());
+    $this->fixtures->dropTables(drupal_container()->get('database'));
 
     parent::tearDown();
   }
@@ -56,7 +56,7 @@ public function tearDown() {
    */
   public function testCandidateOutlines() {
 
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $matcher = new PathMatcher($connection);
 
     $parts = array('node', '5', 'edit');
@@ -76,7 +76,7 @@ public function testCandidateOutlines() {
    * Confirms that we can find routes with the exact incoming path.
    */
   function testExactPathMatch() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $matcher = new PathMatcher($connection, 'test_routes');
 
     $this->fixtures->createTables($connection);
@@ -100,7 +100,7 @@ function testExactPathMatch() {
    * Confirms that we can find routes whose pattern would match the request.
    */
   function testOutlinePathMatch() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $matcher = new PathMatcher($connection, 'test_routes');
 
     $this->fixtures->createTables($connection);
@@ -129,7 +129,7 @@ function testOutlinePathMatch() {
    * Confirms that a trailing slash on the request doesn't result in a 404.
    */
   function testOutlinePathMatchTrailingSlash() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $matcher = new PathMatcher($connection, 'test_routes');
 
     $this->fixtures->createTables($connection);
@@ -158,7 +158,7 @@ function testOutlinePathMatchTrailingSlash() {
    * Confirms that we can find routes whose pattern would match the request.
    */
   function testOutlinePathMatchDefaults() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $matcher = new PathMatcher($connection, 'test_routes');
 
     $this->fixtures->createTables($connection);
@@ -197,7 +197,7 @@ function testOutlinePathMatchDefaults() {
    * Confirms that we can find routes whose pattern would match the request.
    */
   function testOutlinePathMatchDefaultsCollision() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $matcher = new PathMatcher($connection, 'test_routes');
 
     $this->fixtures->createTables($connection);
@@ -237,7 +237,7 @@ function testOutlinePathMatchDefaultsCollision() {
    * Confirms that we can find routes whose pattern would match the request.
    */
   function testOutlinePathMatchDefaultsCollision2() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $matcher = new PathMatcher($connection, 'test_routes');
 
     $this->fixtures->createTables($connection);
@@ -276,7 +276,7 @@ function testOutlinePathMatchDefaultsCollision2() {
    * Confirms that an exception is thrown when no matching path is found.
    */
   function testOutlinePathNoMatch() {
-    $connection = Database::getConnection();
+    $connection = drupal_container()->get('database');
     $matcher = new PathMatcher($connection, 'test_routes');
 
     $this->fixtures->createTables($connection);
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index d0deae1..fc99641 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -183,7 +183,7 @@ function system_requirements($phase) {
   }
   else {
     // Database information.
-    $class = Database::getConnection()->getDriverClass('Install\\Tasks');
+    $class = drupal_container()->get('database')->getDriverClass('Install\\Tasks');
     $tasks = new $class();
     $requirements['database_system'] = array(
       'title' => $t('Database system'),
@@ -191,7 +191,7 @@ function system_requirements($phase) {
     );
     $requirements['database_system_version'] = array(
       'title' => $t('Database system version'),
-      'value' => Database::getConnection()->version(),
+      'value' => drupal_container()->get('database')->version(),
     );
   }
 
@@ -1720,7 +1720,7 @@ function system_update_8006() {
  */
 function system_update_8007() {
   // Find all potential cache tables.
-  $tables = db_find_tables(Database::getConnection()->prefixTables('{cache}') . '%');
+  $tables = db_find_tables(drupal_container()->get('database')->prefixTables('{cache}') . '%');
 
   foreach ($tables as $table) {
     // Assume we have a valid cache table if there is both 'cid' and 'data'
@@ -2056,7 +2056,7 @@ function system_update_8022() {
     'primary key' => array('name'),
   );
 
-  $schema = Database::getConnection()->schema();
+  $schema = drupal_container()->get('database')->schema();
 
   $schema->dropTable('router');
 
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index ea3dadc..06bb38d 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -2322,7 +2322,7 @@ function system_init() {
   // the timestamp after which the slave can be re-enabled.
   if (isset($_SESSION['ignore_slave_server'])) {
     if ($_SESSION['ignore_slave_server'] >= REQUEST_TIME) {
-      Database::ignoreTarget('default', 'slave');
+      drupal_container()->get('database_manager')->ignoreTarget('default', 'slave');
     }
     else {
       unset($_SESSION['ignore_slave_server']);
diff --git a/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php b/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php
index 5fb54e3..f8c6a8b 100644
--- a/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php
@@ -83,7 +83,7 @@ protected function tearDown() {
    */
   public function testUserTempStore() {
     // Create a key/value collection.
-    $factory = new TempStoreFactory(Database::getConnection(), new DatabaseLockBackend());
+    $factory = new TempStoreFactory(drupal_container()->get('database'), new DatabaseLockBackend());
     $collection = $this->randomName();
 
     // Create two mock users.
diff --git a/core/update.php b/core/update.php
index 2273b40..ae6546d 100644
--- a/core/update.php
+++ b/core/update.php
@@ -448,10 +448,6 @@ function update_check_requirements($skip_warnings = FALSE) {
 
 // @todo Remove after converting update.php to use DrupalKernel.
 $container = drupal_container();
-$container->register('database', 'Drupal\Core\Database\Connection')
-  ->setFactoryClass('Drupal\Core\Database\Database')
-  ->setFactoryMethod('getConnection')
-  ->addArgument('default');
 $container->register('router.dumper', '\Drupal\Core\Routing\MatcherDumper')
   ->addArgument(new Reference('database'));
 $container->register('router.builder', 'Drupal\Core\Routing\RouteBuilder')
