Registry / database / loopback-connector-mssql

loopback-connector-mssql

JSON →
library3.8.0jsnpmunverified

Microsoft SQL Server connector for LoopBack framework, wrapping the mssql (node-mssql) driver. Version 3.8.0 supports Node.js >=8. Provides LoopBack models backed by MSSQL tables with automatic CRUD operations, migration, and discovery. Key differentiator: integrates natively with LoopBack datasources and juggler, offering promise/callback API. Release cadence is low; last release 2020. Alternatives: tedious/mssql directly if not using LoopBack.

npm install loopback-connector-mssql
INSTALL
IMPORT
SIG · LOOPBACK-CONNECTOR
L
loopback-connector-mssql
databasejavascriptv3.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Create a LoopBack MSSQL data source, define a model, auto-migrate table, and insert a record.

const datasource = require('loopback-datasource-juggler').DataSource; const ds = new datasource('mssql', { host: process.env.MSSQL_HOST || 'localhost', port: Number(process.env.MSSQL_PORT) || 1433, database: process.env.MSSQL_DB || 'test', user: process.env.MSSQL_USER || 'user', password: process.env.MSSQL_PASSWORD || '' }); const Model = ds.define('MyModel', { name: String, age: Number }); ds.autoupgrade('MyModel', (err) => { if (err) console.error(err); else console.log('Table created or updated'); }); Model.create({ name: 'John', age: 30 }, (err, inst) => { if (err) console.error(err); else console.log('Created:', inst.toJSON()); });
Debug
Known issues
deprecatedLoopBack 3 is end-of-life; consider upgrading to LoopBack 4 or using mssql directly.
fix
Migrate to LoopBack 4 or use mssql package directly.
affects: >=3.0.0
gotchaUsing 'url' connection string alongside individual host/port properties will cause duplicate connection config and undefined behavior.
fix
Use either 'url' OR host/port/database/user/password, not both.
affects: >=1.0.0
gotchaSchema property defaults to 'dbo'; if your tables are in a different schema, you must set it explicitly.
fix
Set 'schema' in datasource config to your schema name.
affects: >=1.0.0
breakingNode.js >=8 required; versions below 8 are not supported.
fix
Update Node.js to >=8 or pin to older connector version.
affects: 3.0.0 - 3.8.0
Errors
Common errors & fixes
Error: ConnectionError: Failed to connect to 127.0.0.1:1433 - Could not connect (sequence)
MSSQL server not running, wrong host/port, or firewall blocks port 1433.
fix
Verify MSSQL service is running, check host/port, and ensure network access.
Error: Login failed for user 'user'
Incorrect username or password, or SQL Server authentication not enabled.
fix
Verify credentials and ensure SQL Server is in mixed authentication mode.
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'user'@'host' (using password: YES)
Using MySQL error message in MSSQL context; actually, check MSSQL authentication settings.
fix
This error is for MySQL; ensure you are using the correct connector. For MSSQL, check login credentials and authentication mode.
TypeError: Cannot read property 'autoupgrade' of undefined
DataSource not properly initialized or model not defined.
fix
Ensure ds is a valid DataSource instance and model is defined before calling ds.autoupgrade().
Upgrade
Version history
3.8.0latest on npm
Audit
Dependencies
loopback-datasource-jugglerrequiredLoopBack ORM dependency for datasource connectivity
mssqlrequiredNode.js MSSQL driver
Agent activity
6 hits · last 30 days
node
6
Resources
loopback-connector-mssql — npm install loopback-connector-mssql · libregistry