Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

close all db connections "too many connections error"

Posted on 2009-05-06
7
Medium Priority
?
1,270 Views
Last Modified: 2013-12-13
Hello,

a shared web server i use recently got an error "Too many connections" all my php code closes the recordset connection at the bottom of page so i thought it may be a database connection. We ended up increasing the connection limit to 500.

i added this to one test site where i know only 1 or 2 users is on the site
 mysql_close($mine);

but we still have 13 connections , but all with Kill runs on them (whatever that means)

is their anything I can add to my website footers to make sure all the recordset and db connections close after page loads?

could it be another problem i dont see?

is their an another server based solution? (windows server)
<?php mysql_close($mine); ?>

Open in new window

0
Comment
Question by:jblayney
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 14

Expert Comment

by:Ali Kayahan
ID: 24319474
 Hi jblayney ,
      It seems something related with your host firm.Even if you have 13 active connections it shouldnt create any issues as you mentioned above.Also using mysql_close() is not necessary if you are not using persistent connections as far as all connections will be closed at the end of script execution.
     To minimize the DB connections you should use singleton pattern , during your database connections, but this is not the exact solution you need.
     If i am not wrong you get the error not because of active connections made from an mysql account,  generally multiple connections from different mysql accounts cause this kind of issues.
    Do you get the error when you run phpmyadmin or some kind of other database management tools ?

0
 
LVL 1

Author Comment

by:jblayney
ID: 24320672
hello,

yes, i fist noticed it using phpmyadmin

i also use dreamweaver to do my connections and basic coding. it closes all recordsets. eg.. it looks like is makes persistant conenctions.. (pconect)

$mine = mysql_pconnect($hostname_mine, $username_mine, $password_mine) or trigger_error(mysql_error(),E_USER_ERROR);
0
 
LVL 7

Accepted Solution

by:
ycTIN earned 500 total points
ID: 24321548
please use  mysql_connect()
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:jblayney
ID: 24321880
ill try, but this is  built in dreamweaver function, how could they make such a mistake, any thoughts?
0
 
LVL 7

Expert Comment

by:ycTIN
ID: 24321972
FYI
http://www.eukhost.com/forums/f18/going-_pconnect-_connect-modifying-dreamweaver-5325/

dreamweaver is not professional php ide, just strong in layout design
0
 
LVL 1

Author Comment

by:jblayney
ID: 24325475
Hello,

i actually found that thread before i posted here. it is easy to change to connect, you do that simply in your connection file.

i just guess im looking for  the bigger explanation. I have used dreamweaver for many years and many versions. they get many things correct and it seems silly that they would overlook something like this.


i am going to change all the sites i built on that server to mysql_connect and see what happens
0
 
LVL 1

Author Closing Comment

by:jblayney
ID: 31578704
yes, dreamweaver does it wrong, i changed all the sites to mysql_connect() and the issue is gone, i was able even able to go into my dreamweaver configuration and change the default and submitted it as an issue to adobe, my steps to modify dreamweaver is on my blog here
http://darkstar-media.blogspot.com/2009/05/mysqlpconnect-and-dreamweaver.html
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question