php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57137 SQL query generates Too Many Connections error
Submitted: 2006-07-11 16:55 UTC Modified: 2006-07-13 14:15 UTC
From: eric at uoregon dot edu Assigned:
Status: Not a bug Package: PDO (PECL)
PHP Version: 5.1.4 OS: RHEL AS 3
Private report: No CVE-ID: None
 [2006-07-11 16:55 UTC] eric at uoregon dot edu
Description:
------------
The following problem occurred on a machine using PHP 5.1.4 
with PDO 1.0.3 and MySQL 5.0.22. The PHP version dropdown 
menu in the bug report form does not have options for 5.1.3 
or above.

While running a simple query that contained the MySQL CONCAT
() function in the SELECT clause the following error was 
returned:

Database Connection Error: SQLSTATE[08004] [1040] Too many 
connections

The server did not have too many connections at the time the 
query was run. There were 13 MySQL processes running out of 
a potential 100. 

The query took the following form:

SELECT CONCAT(field1, '-', field2) AS field1_field2 FROM 
Table

If the new field name after the AS keyword is changed to 
something else, like: field1field2 then the query works.

The initial query works if it's run in the mysql client with 
the same permissions as the web application. The query also 
works when using the built-in PHP MySQL or MySQLi extension 
functions.

I was only able to produce this error on my linux machines. 
I tried the same initial query, with the same AMP stack, on 
a Mac OS X (10.4.7) machine and the query did not complain 
of "Too Many Connections".

In the table I have set-up, field1_field2 corresponds to the 
name of an index on the table. Since changing the name to 
something that does not match table's index fixes the query, 
perhaps PDO registers some sort of collision and 
misinterprets this as a 'Too Many Connections' error. 

Again, I want to stress that when the query is run there are 
NOT too many connections to the server. Memory and disk 
space usage is nominal as well.

Thanks,

Eric Anderson 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-13 14:15 UTC] eric at uoregon dot edu
Never mind. This was an error in my code. A database 
connection call was being run in a loop and generating the 
error. However, MySQL was not logging the multiple 
connection attempts.

At any rate, it is not a PDO or PHP bug. 

Sorry for anyone's time this may have wasted.

Eric Anderson
 [2009-02-12 22:52 UTC] josearmerlin at yahoo dot com
SQL query generates Too Many Connections error

How solve this problem.Is there any php code to stop the connection in runntime.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 11:01:28 2024 UTC