iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-11-2009, 06:17 PM
WebProWorld New Member
 
Join Date: Jun 2009
Posts: 3
webdzine RepRank 0
Default database connections not closing

my host has sent me an email saying that the software i am using is not closing the connection to the database.
what can i do?
Reply With Quote
  #2 (permalink)  
Old 06-11-2009, 06:25 PM
rfuess's Avatar
WebProWorld New Member
 
Join Date: Nov 2004
Location: San Luis Obispo, CA
Posts: 13
rfuess RepRank 0
Default Re: database connections not closing

What software language are you using? That will help use answer in a more meaningful way. I normally program in C# and we have try/catch blocks (like php has). Most who use MySql are programming in php.

When I put the database connection I put it in the "try" part. If there is an error - it falls to the "catch" section. You can optionally use a "finally" clause that is ALWAYS run. Here in the finally section is where I put my database close events. EVEN if there is an ERROR - the connection gets closed.
Reply With Quote
  #3 (permalink)  
Old 06-11-2009, 07:00 PM
WebProWorld New Member
 
Join Date: Jun 2009
Posts: 3
webdzine RepRank 0
Default Re: database connections not closing

we use mysql with php
Reply With Quote
  #4 (permalink)  
Old 06-11-2009, 08:18 PM
danlefree's Avatar
WebProWorld Pro
 
Join Date: Jun 2005
Location: Seattle
Posts: 266
danlefree RepRank 4danlefree RepRank 4danlefree RepRank 4danlefree RepRank 4
Default Re: database connections not closing

Is it possible that your application is configured to use Persistent Database Connections? Check the application manual and configuration (or search the codebase for calls to mysql_pconnect()).
__________________
Dan LeFree | Product Manager (Linux VPS Hosting) | Owner/Operator (Web development, marketing)
Reply With Quote
  #5 (permalink)  
Old 06-12-2009, 12:33 PM
WebProWorld New Member
 
Join Date: Jun 2009
Posts: 3
webdzine RepRank 0
Default Re: database connections not closing

we made sure they are off
Reply With Quote
  #6 (permalink)  
Old 06-12-2009, 01:30 PM
williamc's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jul 2003
Location: GoogleVille
Posts: 1,585
williamc RepRank 7williamc RepRank 7williamc RepRank 7williamc RepRank 7williamc RepRank 7williamc RepRank 7williamc RepRank 7williamc RepRank 7williamc RepRank 7
Default Re: database connections not closing

Quote:
Originally Posted by danlefree View Post
search the codebase for calls to mysql_pconnect()
If you have verified that persistant connections are off in the config, what danlefree suggested, quoted above, is the next step. If your code is using mysql_pconnect() rather than mysql_connect() it could cause you problems like you are seeing. The other options would be 1) catching/trapping errors as rfuess suggested, or optionally 2) making sure you manually close the db connection after running in every call in your scripts. PHP is self cleaning when it comes to this, so it may be that the call is not being finished and the script execution is timing out or just dying before php can clean up, in which case trapping may be the most viable solution for debugging.
__________________
William Cross
Expert Search Engine Optimization
Reply With Quote
  #7 (permalink)  
Old 06-12-2009, 10:45 PM
WebProWorld Member
 
Join Date: Aug 2003
Location: Oklahoma
Posts: 33
netroact RepRank 0
Default Re: database connections not closing

Did your host offer any assistance? They should have been all over this.
Reply With Quote
  #8 (permalink)  
Old 06-25-2009, 06:24 AM
WebProWorld Pro
 
Join Date: Mar 2009
Location: Cardiff, UK
Posts: 134
nickoran RepRank 2
Default Re: database connections not closing

Are you using a CMS like Joomla?, and have you recently installed anynew scripts? I had the same problem with a certain module in Joomla and just installed a different version of the module to get rid of the problem.
__________________
Peace, through superior firepower. "Roach" SAP Jobs : Search Engine Optimisation : SAP
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum

Thread Tools
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql error to many connections dracula IT Discussion Forum 34 08-28-2009 08:34 AM
DW and DB connections? ackerley1 Database Discussion Forum 4 03-31-2006 12:30 PM
Congress proposes tax on all Net, data connections WPW_Feedbot IT Discussion Forum 0 01-28-2005 08:30 PM
How to view the current connections? MELjiip Internet Security Discussion Forum 4 12-23-2004 12:32 AM


All times are GMT -4. The time now is 06:32 PM.



Search Engine Optimization by vBSEO 3.3.0