From: Warren Young Date: April 26 2009 3:45am Subject: =?WINDOWS-1252?Q?Re:_Connection_Pool_=96_How_to_remove_bad_conne?= =?WINDOWS-1252?Q?ction_from_pool=3F?= List-Archive: http://lists.mysql.com/plusplus/8534 Message-Id: <48F2211F-A9C3-4A6B-8762-2EF2A3EA2AE4@etr-usa.com> MIME-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Apr 25, 2009, at 4:50 PM, Jay Rajput wrote: > I have modified the create function to set > the ReconnectOption for connection as true. Good tip. I've added it to the user manual. > Does the reconnect option solves all the problems? You tell me. :) I don't restart my MySQL servers out from under my apps. It can't be done by default, because even if the DB server is allowed to restart separately from the apps using it, those apps might want to be able to detect that this has happened, if only so they can log the incident. Doing it in create() is the right thing, since it's a per- app policy issue. > Is there a way to find out the bad connection without executing a > query > on it. Something like ping ? That's *almost* correct, and so, I've just added Connection::safe_grab() to the svn version. It will appear in 3.1.0, but the current svn version is safe enough to use, I think. svn MySQL+ + will destabilize again at least once more before release, but right now, it should be stable. The problem with pinging the connection before returning it is that the DB server could be restarted between the time ping() succeeds and you try to issue a query. Your code still has to be able to cope with the server going away, either by doing the ReconnectOption or by using the new... ...exchange() method, which I've also added in svn. And, there's also a new remove() method, as originally proposed, used internally by exchange(), but also usable by your own code if you want to do something similar to exchange() but different.