npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

loopback-cnn-mssql

v1.0.5

Published

Modern Microsoft SQL Server connector for LoopBack

Readme

loopback-cnn-mssql

Read in Spanish

Microsoft SQL Server is a relational database management system developed by Microsoft. The loopback-cnn-mssql module is a modern, maintained fork of the Microsoft SQL Server connector for the LoopBack framework.

Features

  • Modernized Codebase: Refactored to use ES6+ classes and async/await.
  • Latest Dependencies: Updated to use mssql v12+.
  • Flexible Configuration: Supports both object-based configuration and connection strings (URLs) with intelligent merging.
  • Security Focused: Regular updates and dependency audits.
  • Prettier & ESLint: Enforced code style and quality.

Installation

In your application root directory, enter:

$ npm install loopback-cnn-mssql --save

This will install the module from npm and add it as a dependency to the application's package.json file.

Usage

Use the Data source generator to add a SQL Server data source to your application. Select other and enter loopback-cnn-mssql as the connector name if it's not listed, or manually configure it.

Configuration Examples

Standard Configuration

The entry in the application's /server/datasources.json will look like this:

"sqlserverdb": {
    "name": "sqlserverdb",
    "connector": "loopback-cnn-mssql",
    "host": "localhost", // or "USER\\SQLEXPRESS" for named instances
    "port": 1433,
    "database": "mydb",
    "user": "sa",
    "password": "Password123!",
    "trustServerCertificate": true, // Useful for local self-signed certs
    "options": {
        "encrypt": true,
        "appName": "MyApp"
    }
}

URL Configuration

You can also use a connection string. Explicit properties will override values parsed from the URL.

"sqlserverdb": {
    "name": "sqlserverdb",
    "connector": "loopback-cnn-mssql",
    "url": "mssql://sa:Password123!@localhost/mydb?encrypt=true&trustServerCertificate=true"
}

Connector settings

To configure the data source to use your MS SQL Server database, edit datasources.json and add the following settings as appropriate. The MSSQL connector uses node-mssql as the driver. For more information about configuration parameters, see node-mssql documentation.

Note: Configuration properties can be placed at the root level or within an options object. Root-level properties take precedence over options.

| Property | Type | Default | Description | | ---------------------- | ------- | --------- | -------------------------------------------------- | | connector | String | | "loopback-cnn-mssql" | | host | String | localhost | Database host name (or server name) | | port | Number | 1433 | Database TCP port | | database | String | | Database name | | user | String | | Database username | | password | String | | Password to connect to database | | url | String | | Connection URL (mssql://...) | | schema | String | dbo | Database schema | | trustServerCertificate | Boolean | false | Set to true to accept self-signed certificates | | encrypt | Boolean | true | Encrypt the connection |

Troubleshooting

Self-signed Certificate Error

If you encounter ConnectionError: Failed to connect to ... - self-signed certificate, it means the driver is rejecting the server's certificate. To fix this in development environments, add trustServerCertificate: true to your configuration.

URL vs Explicit Config

If you provide both a url and explicit properties (like host or user), the explicit properties will override the values found in the URL. This is useful when you have a base URL but need to override specific parameters (like the host for a named instance).

Running tests

The tests require a running SQL Server instance. You can use Docker to run one.

$ npm test

License

MIT