---
title: clsConnection
summary: API reference for clsConnection.
status: draft
owner: <owner>
last_reviewed: 2026-07-23
library: SAIF.Framework.Connection
reference_type: package
---

# clsConnection

`clsConnection` is the sole public class in `SAIF.Framework.Connection`. It resolves Oracle and SQL Server connection strings and assigns them to a caller-supplied connection object, delegating resolution to a remote `ConnectInfo` SOAP web service unless explicit Oracle credentials were supplied at construction.

## Purpose
- Populate the `ConnectionString` property of a caller-supplied `OracleConnection` or `SqlConnection` object so the caller can open and use the connection.
- Provide an Oracle-only local override path that avoids the remote web-service dependency when explicit credentials are supplied at construction.

## Context
- Namespace: `SAIF.Framework.Connection`
- Assembly/package: `SAIF.BOF.Framework.Connection` (`SAIF.Framework.Connection\SAIF.BOF.Framework.Connection.vbproj`); source is also captured into the repository-wide `SAIF.BOF.Framework` NuGet package via a broad nuspec glob, though this library is not packaged independently.*

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| New | `Public Sub New()` | Default constructor; no credential override — subsequent `getConnection` calls resolve via the remote `ConnectInfo` web service. |
| New | `Public Sub New(inOracleUser As String, inOraclePassword As String)` | Sets `m_ConnectStringOverride = True` and stores explicit Oracle credentials, enabling the local override path for the Oracle `getConnection` overload. |
| getConnection | `Public Sub getConnection(inInstance, inCode, inUserid, ByRef inCnObj As OracleConnection, [inPoolFlag], [inLifeTime], [inMaxPoolSize], [inMinPoolSize])` | Populates `inCnObj.ConnectionString` for an Oracle connection, either from local override credentials or from the remote `ConnectInfo.GetOracleConnectString` call, applying `ZSPECIALCHAR`/`Chr(7)` substitution and `Load Balance Timeout=900;` stripping in the non-override path.* |
| getConnection | `Public Sub getConnection(inServer, inCode, inDatabase, ByRef inCnObj As System.Data.SqlClient.SqlConnection)` | Populates `inCnObj.ConnectionString` for a SQL Server connection by calling the remote `ConnectInfo.GetSQLConnectString`; no local override path exists for this overload. |

## Behavioral notes
- Neither `getConnection` overload opens, executes against, or disposes the connection object it populates; the caller is solely responsible for the connection's full lifecycle after the call returns.
- The non-override path for both overloads uses `System.Environment.UserName` as the `OSUserid` value passed to the remote `ConnectInfo` web service, purely as an audit/context parameter — this is not an authentication or authorization check.
- The Oracle overload's post-processing (`ZSPECIALCHAR` → `Chr(7)`, stripping `Load Balance Timeout=900;`) applies only to the web-service-resolved (non-override) path; the local override path builds its connection string directly from the supplied credentials without this post-processing.*
- See [BR-001](../../business-rules.md#br-001-explicit-oracle-credentials-bypass-the-remote-connection-resolution-service), [BR-002](../../business-rules.md#br-002-load-balance-timeout-is-always-stripped-from-oracle-connection-strings), [BR-003](../../business-rules.md#br-003-zspecialchar-token-is-restored-to-a-control-character-in-web-service-resolved-oracle-strings), and [BR-004](../../business-rules.md#br-004-sql-server-connection-resolution-always-delegates-to-the-remote-web-service) for the full business-rule statements enforced by these members.

## Constraints and usage notes
- `clsConnection` is declared `NotInheritable`; it cannot be subclassed.
- The non-override path for both overloads introduces a runtime dependency on the availability of the remote `ConnectInfo` ASMX web service at `http://saifonline/WebServices/wsDBConnections/ConnectInfo.asmx`; if that service is unreachable, connection resolution fails for callers that did not supply explicit Oracle credentials.*
- The local override constructor (`New(inOracleUser, inOraclePassword)`) only affects the Oracle `getConnection` overload; it has no effect on the SQL Server overload, which always depends on the remote web service.
- Callers must open, use, and dispose the `OracleConnection`/`SqlConnection` object themselves after `getConnection` returns; `clsConnection` performs no connection-lifecycle management.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `SAIF.Framework.Connection\clsConnection.vb`
