node.jsで暗号化通信のSQLSERVERに接続する場合

SQLSERVERで通信を暗号化にしている場合、

node.jsから普通に接続を試みてもエラーにすらならず接続できない。

ネットで転がっている下記コードの9行目。

コメントではAzure用と書かれてるけど、これが暗号化なのでこの1行があればOK。


var mssql = require('mssql');
var config = {
  user: '.....',
  password: '.....',
  server: '.....', // You can use 'localhost\\instance' to connect to named instance
  database: '.....',

  options: {
    encrypt: true // Use this if you're on Windows Azure
  }
}

var connection = new sql.Connection(config, function(err) {
...
});

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です