protected function DatabaseTasks::connect

7.x protected DatabaseTasks::connect()

Check if we can connect to the database.

1 call to DatabaseTasks::connect()
DatabaseTasks::runTasks in drupal-7.x/includes/
Run database tasks and tests to see if Drupal can run on the database.


drupal-7.x/includes/, line 431
API functions for installing modules and themes.


Database installer structure.


protected function connect() {
  try {
    // This doesn't actually test the connection.
    // Now actually do a check.
    $this->pass('Drupal can CONNECT to the database ok.');
  catch (Exception $e) {
    $this->fail(st('Failed to connect to your database server. The server reports the following message: %error.<ul><li>Is the database server running?</li><li>Does the database exist, and have you entered the correct database name?</li><li>Have you entered the correct username and password?</li><li>Have you entered the correct database hostname?</li></ul>', array('%error' => $e->getMessage())));
    return FALSE;
  return TRUE;