database in service
This commit is contained in:
19
tools/ws/dbpool.py
Normal file
19
tools/ws/dbpool.py
Normal file
@ -0,0 +1,19 @@
|
||||
import mariadb
|
||||
|
||||
pool = None
|
||||
|
||||
def createConnectionPool():
|
||||
global pool
|
||||
|
||||
pool = mariadb.ConnectionPool(
|
||||
user = 'heroes',
|
||||
password = 'test123',
|
||||
host = '172.16.10.18',
|
||||
database = 'heroes',
|
||||
pool_name = 'wep-app',
|
||||
pool_size = 5
|
||||
)
|
||||
|
||||
def getConnection():
|
||||
global pool
|
||||
return pool.get_connection()
|
Reference in New Issue
Block a user