Database-js driver for SQL Server that works on Linux, Mac, and Windows
This database-js driver is a wrapper for node-mssql and works with MS SQL Server 2000-2017.
npm install --save database-js-mssql
var Connection = require('database-js').Connection;
(async function() {
let conn, statement, results;
try {
conn = new Connection('mssql:///username:password@localhost/database');
statement = conn.prepareStatement("SELECT * FROM states WHERE state = ?");
results = await statement.query("South Dakota");
console.log(results);
} catch (reason) {
console.log(reason);
} finally {
if (conn) {
await conn.close();
}
}
})();