1

I got this error trying to access our SCADA website:

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 341

I scanned into the Loader.php file and on line 341 found this code: $CI->db =& DB($params, $active_record);

This is the complete block with the error code:

public function database($params = '', $return = FALSE, $active_record = NULL)
    {
        // Grab the super object
        $CI =& get_instance();

        // Do we even need to load the database class?
        if (class_exists('CI_DB') AND $return == FALSE AND $active_record == NULL AND isset($CI->db) AND is_object($CI->db))
        {
            return FALSE;
        }

        require_once(BASEPATH.'database/DB.php');

        if ($return === TRUE)
        {
            return DB($params, $active_record);
        }

        // Initialize the db variable.  Needed to prevent
        // reference errors with some configurations
        $CI->db = '';

        // Load the DB class
        $CI->db =& DB($params, $active_record);
    }
Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
Ammar Surti
  • 37
  • 1
  • 11
  • The issue (likely) wont be in the loader but with your CI configuration in `application/config/database.php` are you sure the credentials set are correct? – Brian Ramsey Feb 10 '17 at 15:14
  • We haven't changed anything anywhere. The website and everything was working fine and suddenly this morning it gave us this error. – Ammar Surti Feb 10 '17 at 15:18
  • Is your database server (service) still online? – Brian Ramsey Feb 10 '17 at 15:20
  • Yes. i just out that one of our team mates changed the password on codeignitor on phpmyadmin and now we dont remember what the old password was? How do set the new password on my webserver? anyway i can do it? – Ammar Surti Feb 10 '17 at 15:23
  • I accessed the 'application/config/database.php' and found the password to be : $db['default']['password'] = 'e00864971d044f26353287c12af06441'; How do i decode this? – Ammar Surti Feb 10 '17 at 15:25
  • autoload database in config/autoload.php And show us yoru database settings from config/database.php –  Feb 10 '17 at 20:10

1 Answers1

1

The file you mention is just where the call happened when the issue happened.

The real issue is either:

  1. Your settings in application/configuration/database.php or
  2. Your Database server is down, inaccessible or the credentials have changed
Brian Ramsey
  • 850
  • 7
  • 21
  • Yes as mentioned above, our team mate changed the password on codeignitor. and no one remembers what the old password was. Is there anyway we could reset the password on the application/configuration/database.php? because the password in there is all encoded so if i do change the password on phpmyadmin, i wouldnt know how to set it at the database.php file. – Ammar Surti Feb 10 '17 at 15:29
  • If you use version control yes, just revert, otherwise you have to login as the db root user and change the apps username's password – Brian Ramsey Feb 10 '17 at 15:31
  • As this was the answer, please mark the question as answered – Brian Ramsey Feb 11 '17 at 00:33