Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > Persistent Connections

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-31-03, 16:11
smichae smichae is offline
Registered User
 
Join Date: Dec 2003
Posts: 2
Persistent Connections

Hello,
A script opens a connection to my sql database every time that a user requests that specific script. The problem I am having is, after a while, this error message appears:
User 'site_game' has exceeded the 'max_questions' resource
(current value: 10000).
I have read a little about persistent connections within PHP, but don't really understand how I would be able to get the number of connections to the SQL database down from the current number. Any help would be appreciated!!
Steven Michaels
Reply With Quote
  #2 (permalink)  
Old 01-01-04, 13:37
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: Persistent Connections

Quote:
Originally posted by smichae
Hello,
A script opens a connection to my sql database every time that a user requests that specific script. The problem I am having is, after a while, this error message appears:
User 'site_game' has exceeded the 'max_questions' resource
(current value: 10000).
I have read a little about persistent connections within PHP, but don't really understand how I would be able to get the number of connections to the SQL database down from the current number. Any help would be appreciated!!
Steven Michaels


Basicaly persistent connections using just one physical (shared) connection to the SQL server.

You may to do following:
Create one persistent connection. You will be connecting by standard way, one user - one connection. If max connections will be exceeded (catch the errror) then you simply use the persistent connection opened before.
Reply With Quote
  #3 (permalink)  
Old 01-01-04, 18:03
sundialsvcs sundialsvcs is offline
Registered User
 
Join Date: Oct 2003
Posts: 706
Lightbulb

Google said:
Quote:
Sounds like their host allows a certain number of queries per day/month/week/etc and they've gone over the limit ...
Correct. The problem is the host doesn't know how to change it!


This is a fairly new feature, available since MySQL 4.0.2.
Your host can change it by running a GRANT query (note that these limits can be granted only via a global GRANT, that is, a GRANT ON *.*):

GRANT USAGE
ON *.*
TO user IDENTIFIED BY 'password'
WITH MAX_QUERIES_PER_HOUR N1
MAX_UPDATES_PER_HOUR N2
MAX_CONNECTIONS_PER_HOUR N3; ("0" is "no limit")

In this circumstance I expect that the real cause of the problem is that the application in question is stuck in an endless loop. This is the basic purpose of this feature: preventing a flood of queries from an application whose bug might otherwise never be diagnosed. It's quite reasonable that any application which manages to put out 10,000 queries an hour, and whose user/owner is surprised by a limit-message to that effect, is probably misbehaving. (Or seriously mis-coded!)

I would ask for assistance from the ISP in obtaining any sort of log that might be available to find out where the endless-loop bug is.

Note: I do not know if a persistent connection affects the limit and therefore the appropriateness of that conclusion. Most likely a persistent connection would not reset the count. Maybe if this is the most popular and compute-intensive website God ever made, it would justifiably hit this kind of a limit. I dunno. But I'd suspect a programming error first.
__________________
ChimneySweep(R): fast, automatic
table repair at a click of the
mouse! http://www.sundialservices.com

Last edited by sundialsvcs : 01-01-04 at 18:08.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On