getConnection method
Get a connection from a pool
If poolName is provided, gets connection from that pool. Otherwise, gets from the default pool.
Implementation
Future<OracleConnection> getConnection({
String poolName = 'default',
OracleConfig? config,
}) async {
_ensureInitialized();
// If no pool exists and config is provided, create a direct connection
if (!_pools.containsKey(poolName) && config != null) {
return OracleConnection.connect(
dpiOracle: _dpiOracle!,
context: _context!,
config: config,
);
}
// Get from pool
final pool = _pools[poolName];
if (pool == null) {
throw OraclePoolException(
'No pool found with name "$poolName". '
'Create a pool first or provide config for direct connection.',
);
}
return pool.getConnection();
}