Registry / database / sails-mssqlserver

sails-mssqlserver

JSON →
library0.14.3jsnpmunverified

SQL Server adapter for Sails.js and Waterline ORM, version 0.14.3. Allows Sails applications to connect to Microsoft SQL Server databases, including Azure. Provides Waterline-compatible queries, transactions, and schema auto-migration. Minimal release cadence; last updated in 2019. Differentiators: directly integrates with Sails/Waterline lifecycle. Limitations: outdated dependencies, no active support.

npm install sails-mssqlserver
INSTALL
IMPORT
SIG · SAILS-MSSQLSERVER
S
sails-mssqlserver
databasejavascriptv0.14.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sails-mssqlserver
// Install: npm install sails-mssqlserver // Configure in config/datastores.js: module.exports = { default: 'sqlserver', datastores: { sqlserver: { adapter: 'sails-mssqlserver', host: 'localhost', port: 1433, database: 'mydb', user: 'sa', password: 'password' } } };
const mssql = require('sails-mssqlserver');
Not a direct import; you configure the adapter in Sails datastores config. The adapter is loaded by Waterline.
sails-mssqlserver
// In Sails app, no import needed; Sails loads adapters automatically from config.
import sailsMssql from 'sails-mssqlserver';
The adapter is not imported directly in user code.
sails-mssqlserver
// Using waterline standalone: const Waterline = require('waterline'); const sailsMssqlAdapter = require('sails-mssqlserver'); const waterlineConfig = { adapters: { 'sails-mssqlserver': sailsMssqlAdapter }, datastores: { default: { adapter: 'sails-mssqlserver', host: 'localhost', port: 1433, database: 'mydb', user: 'sa', password: 'password' } } };
const mssql = require('sails-mssqlserver');
When using Waterline standalone, you need to pass the adapter to Waterline as shown.

Shows installation, datastore config for SQL Server, model definition, and basic CRUD.

// 1. Install adapter // npm install sails-mssqlserver // 2. Configure datastore in config/datastores.js module.exports.datastores = { default: { adapter: 'sails-mssqlserver', host: 'localhost', port: 1433, database: 'mydb', user: 'sa', password: 'your_password_here', options: { encrypt: false, // set true for Azure trustServerCertificate: true // for self-signed certs } } }; // 3. Use in model (api/models/User.js) module.exports = { datastore: 'default', attributes: { name: { type: 'string', required: true }, email: { type: 'string', unique: true } } }; // 4. Query in controller/api await User.create({ name: 'John', email: 'john@example.com' }); const users = await User.find(); console.log(users);
Debug
Known issues
deprecatedsails-mssqlserver often uses deprecated versions of tedious/mssql packages.
fix
Consider using sails-sqlserver or sails-mssql (or more modern alternatives).
affects: >=0.12.0
gotchaencrypt option must match your SQL Server configuration (true for Azure, false for local).
fix
Set options.encrypt appropriately based on your environment.
affects: >=0.12.0
gotchatrustServerCertificate may be needed for self-signed certificates.
fix
Set options.trustServerCertificate: true in development.
affects: >=0.12.0
gotchaSome SQL Server data types (e.g., geography, hierarchyid) may not be fully supported.
fix
Use more specific adapters or handle type conversions manually.
affects: >=0.12.0
Errors
Common errors & fixes
Error: self-signed certificate in certificate chain
SQL Server uses self-signed cert; Node rejects it.
fix
Set options.trustServerCertificate: true in datastore config.
ConnectionError: Failed to connect to localhost:1433 - connect ECONNREFUSED
SQL Server not running or wrong port/host.
fix
Verify SQL Server is running and accessible on host:port. Check firewall.
error: Error: Login failed for user 'sa'.
Invalid credentials or SQL Server authentication not enabled.
fix
Ensure SQL Server authentication mode allows SQL logins. Check username/password.
TypeError: Cannot read property 'type' of undefined
Missing or incorrect model attribute definition.
fix
Define attributes in model with proper types: 'string', 'number', 'boolean', etc.
Upgrade
Version history
0.14.3latest on npm
Audit
Dependencies
sailsrequiredpeer dependency for adapter use
waterlinerequiredcore ORM adapter interface
Agent activity
9 hits · last 30 days
node
8
Meta
1
Resources
sails-mssqlserver — npm install sails-mssqlserver · libregistry