Test TCP connectivity to a SQL Server instance.
Opens a raw TCP socket to the specified host and port. If the connection
is established within the timeout, returns { Reachable: true }. Otherwise
returns a structured error with a human-readable message tailored to common
failure modes (ECONNREFUSED, ENOTFOUND, ETIMEDOUT, ECONNRESET).
SQL Server hostname or IP address.
SQL Server TCP port (typically 1433).
Maximum time to wait for the connection, in milliseconds (default: 5000).
Connectivity result with reachability status, optional error, and latency.
Run SQL batches in order on one connection, so USE in one batch carries
into the next, exactly as SSMS or sqlcmd would run a script split on GO.
Server and credentials; Database is where the session starts.
Batch texts with the GO separators already removed.
Receives each PRINT / informational message the server sends.
Sign in to SQL Server and open target.Database, then disconnect.
Server, database, and credentials to try.
Whether the sign-in worked and, if not, whether SQL Server refused it.
Lightweight adapter for testing SQL Server connectivity via raw TCP sockets.
Does not perform SQL authentication or execute queries — only verifies that the host:port is accepting TCP connections. This is sufficient for preflight checks and post-provisioning validation.
Example