- VERSION 4.11.14

- Se agregó el parametro "setMaxPoolSize=5" para que solo genere 5 conexiones a la base de datos, antes generaba 15.
- Se quitaron lineas previamente comentadas.
This commit is contained in:
Jose Alberto Guerra Ugalde
2024-11-15 03:36:21 -06:00
parent a801577b6f
commit 45e4336d3c
7 changed files with 81 additions and 48 deletions

View File

@@ -17,12 +17,64 @@ End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(DB As String)
' Log("RDCConnector Initialize")
If DB.EqualsIgnoreCase("DB1") Then DB = "" 'Esto para el config.properties or default
' If DB.EqualsIgnoreCase("DB1") Then DB = "" 'Esto para el config.properties or default
If DB.EqualsIgnoreCase("DB1") Then DB = "" 'Esto para el config.properties por default
Dim config As Map = LoadConfigMap(DB)
Log($"Inicializamos ${DB}, usuario: ${config.Get("User")}"$)
pool.Initialize(config.Get("DriverClass"), config.Get("JdbcUrl"), config.Get("User"), _
config.Get("Password"))
pool.Initialize(config.Get("DriverClass"), config.Get("JdbcUrl"), config.Get("User"), config.Get("Password"))
Dim jo As JavaObject = pool
jo.RunMethod("setMaxPoolSize", Array(5)) 'number of concurrent connections
' com.mchange.v2.c3p0.ComboPooledDataSource [
' acquireIncrement -> 3,
' acquireRetryAttempts -> 30,
' acquireRetryDelay -> 1000,
' autoCommitOnClose -> False,
' automaticTestTable -> Null,
' breakAfterAcquireFailure -> False,
' checkoutTimeout -> 20000,
' connectionCustomizerClassName -> Null,
' connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester,
' contextClassLoaderSource -> caller,
' dataSourceName -> 2rvxvdb7cyxd8zlw6dyb|63021689,
' debugUnreturnedConnectionStackTraces -> False,
' description -> Null,
' driverClass -> oracle.jdbc.driver.OracleDriver,
' extensions -> {},
' factoryClassLocation -> Null,
' forceIgnoreUnresolvedTransactions -> False,
' forceSynchronousCheckins -> False,
' forceUseNamedDriverClass -> False,
' identityToken -> 2rvxvdb7cyxd8zlw6dyb|63021689,
' idleConnectionTestPeriod -> 600,
' initialPoolSize -> 3,
' jdbcUrl -> jdbc:oracle:thin:@//10.0.0.110:1521/DBKMT,
' maxAdministrativeTaskTime -> 0,
' maxConnectionAge -> 0,
' maxIdleTime -> 1800,
' maxIdleTimeExcessConnections -> 0,
' maxPoolSize -> 5,
' maxStatements -> 150,
' maxStatementsPerConnection -> 0,
' minPoolSize -> 3,
' numHelperThreads -> 3,
' preferredTestQuery -> DBMS_SESSION.SET_IDENTIFIER('whatever'),
' privilegeSpawnedThreads -> False,
' properties -> {password=******, user=******},
' propertyCycle -> 0,
' statementCacheNumDeferredCloseThreads -> 0,
' testConnectionOnCheckin -> False,
' testConnectionOnCheckout -> True,
' unreturnedConnectionTimeout -> 0,
' userOverrides -> {},
' usesTraditionalReflectiveProxies -> False
' ]
' Dim jo2 As JavaObject = pool
' Log(jo2.GetField("END_TO_END_CLIENTID_INDEX"))
jo.RunMethod("setPreferredTestQuery", Array("BEGIN DBMS_SESSION.SET_IDENTIFIER('whatever'); END;"))
' jo.RunMethod("setPreferredTestQuery", Array("alter session set current_schema=MYSCHEMA"))
' jo2.RunMethod("setClientIdentifier",Array( "MAX")) ' Tiempo máximo de inactividad antes de cerrar una conexión
#if DEBUG
DebugQueries = True
#else
@@ -33,13 +85,6 @@ Public Sub Initialize(DB As String)
LoadSQLCommands(config, DB)
End Sub
'Sub closePool
' If pool.GetConnection.IsInitialized Then
' pool.ClosePool
' Log("----- Cerramos pool")
' End If
'End Sub
Private Sub LoadConfigMap(DB As String) As Map
Private DBX As String = ""
If DB <> "" Then DBX = "." & DB