• 1 min read

Data Series: Get Started With the Node.js Driver for SQL Server

One of the things that sort of snuck out in the spring update for Windows Azure is the Microsoft Driver for Node.js for SQL Server. A long name for a driver with a singular purpose: connecting your…

One of the things that sort of snuck out in the spring update for Windows Azure is the Microsoft Driver for Node.js for SQL Server. A long name for a driver with a singular purpose: connecting your node applications to SQL Server technologies such as the Windows Azure SQL Database.

Currently the driver is available as a preview release, and the code is available on GitHub.

Working with SQL Database

The driver is very easy to use, expecting only a standard ODBC connection string (easily obtained through the Windows Azure Preview Portal,) and allows you to issue Transact-SQL statements through the query method. Where things get a little different is that you can return a ‘statement’ from a query that allows you to receive events as data entities are returned through the query.

How-to Guidance

For the basics of working with Windows Azure SQL Database using the driver, see How to Access Windows Azure SQL Database from Node.js. This provides basic information on:

  • Using the new preview portal to provision a database

  • Retrieving the ODBC connection information
  • Creating a basic application to query the database
  • Considerations for deploying the driver to a Windows Azure Web Site

Tutorial

The Node.js Web Application using the Windows Azure SQL Database article provides a more complex example of using the driver in a node application. This tutorial walks through:

  • Creating an MVC application using the Express module
  • Creating a new web site and database using the preview portal
  • Designing a database using the portal
  • Using web site app settings to specify the connection string at run-time
  • Deploying the web site using Git

Contributions

As I mentioned earlier, this driver is available on GitHub and that includes accepting issues, feedback and contributions from you. Feel free to drop by and let us know what you want to see in this driver, or submit code to add a feature yourself.

-By Larry Franks, Principal Programming Writer, Windows Azure