I get an application with several thread , with each thread using it's own
connection.
What I mean is that the thread create a connection at the beginning and
close and detroy it before it close.

Under some circustances some of these threads close itself and reopen after
few minutes ( for example 60 secs. ).
When this appened also if the connection is closed , it is still registered
as active by mysql.
So I got that each time a new thread is started a new connection is added to
the list of mysql connection.
When the thread  died , mysql keep a reference to an idle connection until
the wait_timeout expiration time.

So I must keep the value of  wait_timeout  lower , ie. = 120, while the
preferred value should higher that this value.

There are some way to shorten the timeout for removing the connections
without interfere with the timeout used for still active connection ?


I'm using mdac with c++buider 6 and the way I create and destroy the
connection are showed  belowe:

TMyConnection * __fastcall TDataModule_PMV::NewMyConnection(String hostName)
{
       String strmsg;
       TMyConnection * myConn = 0;
       myConn = new TMyConnection( NULL );

           myConn->Server      = hostName;
           myConn->Database    = "mydatabaser";
           myConn->Username    = "my_user";
           myConn->Password    = "my_password";
           myConn->LoginPrompt = false;
           myConn->Connected   = true;

       return myConn;
}


/********************************************************/
void __fastcall TDataModule_PMV::RemoveMyConnection(TMyConnection * dbConn)
{
       if( dbConn )
       {
         dbConn->Connected = false;
         delete dbConn;
         dbConn = 0;
       }
}



Regards,
Enzo Arlati   [EMAIL PROTECTED]
AESYS Via Artigiani, 41  24060 Brusaporto (BG) - Italy
Tel. +39 (0)35.2924.182   Fax +39 (0)35 680030


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to