我使用 SQL Server Express 2012 的命名实例如果我尝试使用 SSMS 连接到它,它可以工作,使用以下参数:
Server name: mit-007\SQLEXPRESS2012
Authentication: SQL Server Authentication
Login: sa
Password: mit
Run Code Online (Sandbox Code Playgroud)
使用节点 mssql:
var sql = require('mssql');
var config = {
user: 'sa',
password: 'mit',
server: 'mit-007',
driver: 'tedious',
database: 'Delvi',
options: {
instanceName: 'SQLEXPRESS2012'
}
};
sql.connect(config).then(function(){ // and so on
Run Code Online (Sandbox Code Playgroud)
它记录了这个错误
{ [ConnectionError: Failed to connect to mit-007:undefined in 15000ms]
name: 'ConnectionError',
message: 'Failed to connect to mit-007:undefined in 15000ms',
code: 'ETIMEOUT' }
Run Code Online (Sandbox Code Playgroud)