Skip to content

al3duc/Simple-Example-Pool-Connection-in-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Example Pool Connection in Python

How to use this?

from PoolManagerLib import PoolManager
import pymssql 

poolConn= PoolManager.getInstance()
poolConn.setPoolSize(100) # Set max pool size

#A handle is created for the creation of the objects that will be managed in the pool. 
#In this case I use pymssql for this example, although theoretically any object is valid.
def handler():
    return pymssql.connect(server='localhost', user='sa', password='123', database='test')
   
poolConn.setResourceHandler(handler)


 conn= poolConn.getResource() # Get a connection

 ...

 poolConn.release(conn) #Return the connection to the pool

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages