---
title: Resolve SQL Server connection
summary: Populate a caller-supplied SqlConnection with a connection string resolved from the ConnectInfo SOAP service.
status: draft
owner: SAIF Framework
last_reviewed: 2026-07-30
library: SAIF.Framework.Connection
reference_type: package
operation_id: OP-CONN-002
trigger: Caller invokes the SQL Server overload of clsConnection.getConnection
---

# Resolve SQL Server connection

This operation populates the `ConnectionString` of a caller-supplied `SqlConnection` by calling the remote `ConnectInfo` SOAP service. Unlike the Oracle overload, it has no local-override path: every invocation depends on a live response from the web service.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-CONN-002 |
| **Trigger** | Caller request to populate a `SqlConnection` |
| **Inputs** | `inServer`, `inCode`, `inDatabase`, `inCnObj` |
| **Outputs** | `inCnObj.ConnectionString` populated with the resolved SQL Server connection string |
| **Primary components** | `clsConnection.getConnection`, `ConnectInfo.ConnectInfo.GetSQLConnectString` |
| **Entry point** | `SAIF.Framework.Connection\clsConnection.vb` |

## Steps

1. Instantiate a `ConnectInfo.ConnectInfo` SOAP proxy and a blank `ConnectInfo.ConnectRequestInfo` request object.
   - The generated proxy constructor reads the service endpoint URL from the [`SAIF_Framework_Connection_ConnectInfo_ConnectInfo` setting](../configuration.md), the same setting used by the Oracle overload's remote-resolution path.
2. Populate the outbound request payload for the SOAP call.
   - Set `Composite.Code = inCode`.
   - Set `Composite.Database = inDatabase`.
   - Set `Composite.Server = inServer`.
   - Set `Composite.OSUserid = System.Environment.UserName`, providing an audit identity to the remote service rather than performing any local authorization check.
3. Ensure a target connection object exists before assignment.
   - If `inCnObj` is `Nothing`, create a new `System.Data.SqlClient.SqlConnection` and use it as the resolution target.
4. Resolve the SQL Server connection string and apply it directly, with no post-processing.
   - Call `Client.GetSQLConnectString(Composite)` ([BR-004](../business-rules.md#br-004-sql-server-connection-resolution-always-delegates-to-the-remote-web-service)).
   - Assign the returned value directly to `inCnObj.ConnectionString`; unlike the Oracle overload, no token substitution or clause stripping is performed here.
   - On failure: exceptions raised during proxy construction, the SOAP call, or the final property assignment propagate to the caller unchanged; this method has no local `Try`/`Catch` handling.
5. Return control to the caller.
   - `clsConnection` does not open, test, or dispose the `SqlConnection`; the caller owns that lifecycle from this point forward.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Caller invokes SQL Server getConnection]) --> Init[Instantiate ConnectInfo proxy and request object]
	Init --> Prepare[Populate Composite fields]
	Prepare --> Ensure[Ensure SqlConnection instance exists]
	Ensure --> Resolve[Call GetSQLConnectString]
	Resolve --> Assign[Assign ConnectionString]
	Assign --> EndOk([Return populated SqlConnection])
```

## Failure and edge-case behavior

- This overload always depends on the `ConnectInfo` SOAP service; there is no local override branch comparable to the Oracle overload's credential-based bypass, so a caller cannot avoid the remote dependency for SQL Server connections.
- The method performs a single synchronous remote lookup per call and provides no retry, timeout, or fallback logic.
- Any failure in proxy construction, the SOAP invocation, or the connection-string assignment exits the method without local recovery logic, surfacing directly to the caller.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Configuration](../configuration.md)

## Sources
- `SAIF.Framework.Connection\clsConnection.vb`
- `SAIF.Framework.Connection\Web References\ConnectInfo\Reference.vb`
- `SAIF.Framework.Connection\My Project\Settings.Designer.vb`
- `SAIF.Framework.Connection\app.config`
