Fero
Fero

Reputation: 13315

Database Connection Failed

While I am browsing my online app in the server I got an error like

Database Connection Failed

User coule_com@c17564 already has more than 'max_user_connections' active connections.

But this is working well in my local system. And this error occurs ANY TIME when I navigate in the server. If i refresh the browser i can able to move further. But I in need to solve this issue.

will anybody help me to solve this issue ?

connection code :

function makeConnection() { 
    global $config;
    $this->ConLink = mysql_pconnect($config['DBHostName'],$config['DBUserName'],$config['DBPassword']) or die("Database Connection Failed". mysql_error());
    mysql_select_db($config['DBName'], $this->ConLink);
    return true;
}

Upvotes: 1

Views: 970

Answers (2)

longneck
longneck

Reputation: 12226

you need to contact your host and get them to up the connection limit. if they won't, you need to find a better host. this is simply a fact of life in web-based applications.

Upvotes: 1

Lasse V. Karlsen
Lasse V. Karlsen

Reputation: 391704

Are you closing the connections when you're done with them?

If not, then I would assume there's lots of database connection objects lying around just waiting for GC to pick them up, and until it does, you risk running out of available connections.

Upvotes: 3

Related Questions