CodeIgniter Forums

Full Version: Turn off "You have specified an invalid database connection group."
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]huzzel[/eluser]
How could i do that ?

thanks :-)

El Forum

[eluser]summery[/eluser]
The best way might be to specify a valid database connection group. Wink

Read about establishing database connections in CI.

Two basic things to check for in your config/database file:
- is $active_group variable set to a valid array of config variables? Default, perhaps?
- are your database config variables correct - hostname, db name, etc?

Good luck!

El Forum

[eluser]mikelbring[/eluser]
Or don't autoload the database?

El Forum

[eluser]huzzel[/eluser]
Thanks for your replies,

i tried to connect to different databases in a controller

so i created a object for each database like this

$this->active_db_1
$this->active_db_2
$this->active_db_3

If one of the database server goes offline the script dies...

Maybe i have to check first db_connect() before i load each active_db

well the problem is here

Code:
function &DB;($params = '', $active_record_override = FALSE)
{
    // Load the DB config file if a DSN string wasn't passed
    if (is_string($params) AND strpos($params, '://') === FALSE)
    {
        include(APPPATH.'config/database'.EXT);
        
        if ( ! isset($db) OR count($db) == 0)
        {
            show_error('No database connection settings were found in the database config file.');
        }
        
        if ($params != '')
        {
            $active_group = $params;
        }
        
        if ( ! isset($active_group) OR ! isset($db[$active_group]))
        {
            show_error('You have specified an invalid database connection group.');
        }
        
        $params = $db[$active_group];
    }

So i hav to patch the controller DB.

I created a helper to solute this

thanks