sql-serverazure-sql-databasenode-sqlserver

Microsoft's Node.JS driver does not work


I tried following this but with no luck. http://blogs.msdn.com/b/sqlphp/archive/2012/06/08/introducing-the-microsoft-driver-for-node-js-for-sql-server.aspx

Every time I try to build it, it fails.

Does anyone have any ideas as to why does it fail to build. I am also using the latest version of Node if that helps.


Solution

  • Thanks for your question. Just to clarify you are using the msnodesql driver right?

    One of the reasons that you might not be able to build is because you are using the latest node version.

    The Microsoft Node.js driver is not forward compatible. The next version is in the pipeline. In the meanwhile you will have to downgrade your node.js version to 0.8.9.

    Additionally there are a few other requirements. Follow these steps and you should be good.

    Then just enter these in your node.js command prompt

    1. npm install msnodesql
    2. npm install -g node-gyp
    3. node-gyp configure 
    4. node-gyp build
    

    You should now see a build folder inside msnodel.

    Navigate to build > release. Copy the sqlserver.node file and paste it in the msnodesql > lib folder. Replace the old file if needed.

    Now you can follow the rest of the instructions on the blog you mentioned which will help you with connection string and connecting to your db. Let me know if you are still stuck.

    Thanks