473,408 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

DB connection handling - i get "too many connection" - what's the solution?

I have a php-webpage that needs the database in the beginning and in
the end of the script. In the middle there is a lot of processing that
takes several seconds - during that time I don't use the database
connection.

What is the best approach? Should I close the connection after I'm
done with it OR should I reuse the connection thru my whole script?

Where can I read more about this? Any pointers?

Today I'm using the same connection thru my script. And sometimes I
get an error from the database "too many connections". What does that
mean? My webserver provider says that I have at least 100 connections
to play with. How come I get this error????

Thank you for all your help!!!!

Leif
Jul 17 '05 #1
3 2685
Leif Wessman wrote:
I have a php-webpage that needs the database in the beginning and in
the end of the script. In the middle there is a lot of processing that
takes several seconds - during that time I don't use the database
connection.

What is the best approach? Should I close the connection after I'm
done with it OR should I reuse the connection thru my whole script?

Where can I read more about this? Any pointers?

Today I'm using the same connection thru my script. And sometimes I
get an error from the database "too many connections". What does that
mean? My webserver provider says that I have at least 100 connections
to play with. How come I get this error????

Thank you for all your help!!!!

Leif


Are you using persistant connections to your database?

--
Amir Khawaja.

----------------------------------
Rules are written for those who lack the ability to truly reason, But
for those who can, the rules become nothing more than guidelines, And
live their lives governed not by rules but by reason.
- James McGuigan
Jul 17 '05 #2
No, should I? I have lots of traffic to my website.

Leif

Amir Khawaja <am**@gorebels.net> wrote in message news:<fDbUb.24797$QJ3.13194@fed1read04>...
Leif Wessman wrote:
I have a php-webpage that needs the database in the beginning and in
the end of the script. In the middle there is a lot of processing that
takes several seconds - during that time I don't use the database
connection.

What is the best approach? Should I close the connection after I'm
done with it OR should I reuse the connection thru my whole script?

Where can I read more about this? Any pointers?

Today I'm using the same connection thru my script. And sometimes I
get an error from the database "too many connections". What does that
mean? My webserver provider says that I have at least 100 connections
to play with. How come I get this error????

Thank you for all your help!!!!

Leif


Are you using persistant connections to your database?

Jul 17 '05 #3
Leif Wessman wrote:
No, should I? I have lots of traffic to my website.


Try persistant connections and see what sort of results you end up
getting. However, I doubt that will solve your problem but it does not
hurt to try. I'm assuming here that you are using MySQL (since it is the
popular DB server for PHP). One thing to note about MySQL is that if
your script runs for a long time, you may want to explicitly close the
connection prior to executing the code that takes a long time. This way,
you are not holding up the connection for other potential users of your
system. 100 is a default value set by MySQL. It means that 100
simultaneous connections may remain open at any given time.

--
Amir Khawaja.

----------------------------------
Rules are written for those who lack the ability to truly reason, But
for those who can, the rules become nothing more than guidelines, And
live their lives governed not by rules but by reason.
- James McGuigan
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Yi | last post by:
Hi, I am a scientist and new to .NET programming. On my PC, I am using Windows 2000 professional with IIS, SQL Server 2000 (standard, personal), Visual Basic .net (2003, standard). By following...
1
by: Muscha | last post by:
Hello, Every now and then my application throw this exception: "Unable to read data from the transport connection" And when I break into the Visual Studio, the thread where it failed has...
6
by: karim | last post by:
I have an asp.net page that stopped running properly giving the error below. The app uses a SQL Server 2000 on another server. Enterprise Manager and Query analyzer on the web server can connect to...
8
by: VB Programmer | last post by:
I have a web solution that I deployed to our web server. I was looking at the site (on my PC), and so was my customer (on his PC). It worked well for like 10 minutes. Then, all of a sudden we...
4
by: Ryan | last post by:
I am hoping to get some ideas on how to handle a case when an application gets too many requests for an application... I would like to handle the case well... (1) is the answer in using the...
7
by: Henry | last post by:
I am writing a Windows forms VB.Net/MS SQL application via VS 2003 that utilizes Crystal Reports. I want to be able to dynamically set the report data source at run time. I'm trying to change...
7
by: pike | last post by:
db2 8.1 FP11 on AIX 5.3.0.0 . The db2diag.log is intermittently reporting EMFILE (24) "Too many open files" errors. The culprit is always db2hmon. Sample db2diag.log output follows: ...
7
by: STUPIDFORUM | last post by:
ADODB.Recordset "The connection cannot be used to perform this operation." "Microsoft Access Driver" ERROR 0X800A0E7D OLE exception from "ADODB.Recordset": The connection cannot be used to...
30
by: Medvedev | last post by:
i see serveral source codes , and i found they almost only use "new" and "delete" keywords to make they object. Why should i do that , and as i know the object is going to be destroy by itself at...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.