Skip to main content

MssqlAdapter

MssqlAdapter is the Adapter implementation shipped by @sqb/mssql, connecting to Microsoft SQL Server via mssql (tedious-based). It self-registers with AdapterRegistry as a side effect of importing @sqb/mssql — see the SQL Server adapter guide for setup and configuration.

import '@sqb/mssql';

Constructor

new MssqlAdapter()

Takes no arguments. You normally never construct this directly — importing @sqb/mssql registers a shared instance with AdapterRegistry for you.

Properties

PropertyTypeDescription
driver'mssql'The driver name, matched against ClientConfiguration.driver.
dialect'mssql'The dialect name, matched against ClientConfiguration.dialect.
featuresAdapter.Features{ cursor: true }.

Methods

connect()

connect(config: ClientConfiguration): Promise<Adapter.Connection>

Opens a mssql ConnectionPool and connects it. config.host maps to server (defaulting to 'localhost'); .port, .user, .password, and .database are mapped onto the driver's own config object. config.driverOptions.encrypt/.trustServerCertificate (defaulting to false/true) and .options seed config.options; the rest of driverOptions is spread onto the top-level config object. Returns a MssqlConnection wrapping the connected pool.

See also