Sub Process_Globals
Public pool As ConnectionPool
Dim jo As JavaObject
End Sub
Public Sub Initialize
pool.Initialize("com.mysql.jdbc.Driver","jdbc:mysql://127.0.0.1:3306/testdb?characterEncoding=utf8&autoReconnect=true&useSSL=false","root","")
jo = pool
jo.RunMethod("setMinPoolSize", Array(0))
jo.RunMethod("setMaxPoolSize", Array(50))
jo.RunMethod("setMaxIdleTime", Array As Object(60))
jo.RunMethod("setMaxStatements", Array As Object(1))
jo.RunMethod("setNumHelperThreads", Array As Object(10))
jo.RunMethod("setCheckoutTimeout", Array As Object(60000))
jo.RunMethod("setMaxIdleTimeExcessConnections", Array As Object(60))
End Sub
Public Sub LogPoolStatus
If pool.IsInitialized Then Log("CurrentPoolConnections = " & jo.RunMethod("getNumConnections",Null) & " | MaxPoolConnections = " & jo.RunMethod("getMaxPoolSize",Null))
End Sub
Public Sub Sync
LogPoolStatus
Dim sql1 As SQL = pool.GetConnection
Dim rs As ResultSet = sql1.ExecQuery("Show tables")
If rs.NextRow Then
Log("Database Sync")
Else
ExitApplication
End If
rs.Close
sql1.Close
LogPoolStatus
End Sub