Partilhar via


Connect Azure SQL Database from Node.js Application

We can easily connect MS Azure SQL Database from our Node.js application. There is a package known as mssql.

So we need to run

$ npm mssql

In Azure, I have a database and table Employee. One important options we need to add while connecting SQL Azure is encrypt: yes. Also we don't need to use port 1433 explicitly while providing connection string information.

Here is the simple code snippet on how to connect

The output would look like,

Namoskar!!!

Comments

  • Anonymous
    February 02, 2017
    I'm doing something like you do, but I'm connecting/disconnecting each query, (this is my stack overflow question https://goo.gl/4KkFcr) I'm not sure if that this is a correct way.I can not figure out how to use only one connection to reduce latency and number of connections at once. Help!