适用于 Node.js 的 Microsoft SQL Server 客户端
适用于 Node.js 的 Microsoft SQL Server 客户端 [![NPM 版本][npm-image]][npm-url] [![NPM 下载量][downloads-image]][downloads-url] 支持的 TDS 驱动程序:
npm install mssqlnpm install mssql msnodesqlv8此包需要 TCP/IP 才能连接到 SQL Server,您可能需要在安装过程中启用此选项。
const sql = require('mssql')
(async () => {
try {
// make sure that any items are correctly URL encoded in the connection string
await sql.connect('Server=localhost,1433;Database=database;User Id=username;Password=password;Encrypt=true')
const result = await sql.query`select * from mytable where id = ${value}`
console.dir(result)
} catch (err) {
// ... error checks
}
})()如果您使用的是 Windows Azure,请在连接字符串中添加?encrypt=true。如需了解更多信息,请参阅 文档。
暂无开放 Issues,或尚未同步最近议题。