I would like to use connection pool with MySQL in Middle Kit. I created
my code as was written in example but in that case a new connection
was created for  each time I access to DB. And this connections are
never closed by Middle Kit. After a shot time i had about 50
connections. So the question is - How can I close my connetions
mannualy or return them into pool? 

Please, answer my question even it looks like I nave an error in
/dev/hands - I have many code written.

{                                                                       
'Package': 'test.Middle',           
'Database': 'aventradb',                                                
#'SQLLog': { 'File': 'mk-sql.log' },        
'SQLConnectionPoolSize': 2                                              
}   

May be I must do MySQLObjectStore() in awake?
I had a try with next code:

from MiddleKit.Run.MySQLObjectStore import MySQLObjectStore
.........
        def awake( self, transaction ):                                 
                Page.awake( self,transaction )                               
                if not self.connection:        
                        self.connection = MySQLObjectStore(user='user',passwd='' )     

But still having new poll for each refer. 

I put code into __init__.py in my context and now I get it working
__init__.py
from MiddleKit.Run.MySQLObjectStore import MySQLObjectStore             
mk_conn = MySQLObjectStore(user='someuser',passwd='somepass' )          
mk_conn.readModelFileNamed('test/Middle/Billing')

index.py
...........
import __init__
stor = __init__.mk_conn
ObjLists = stor.fetchObjectsOfClass("Customer",
clauses=searchConditions)

Is it a correct way?




-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to