简体   繁体   中英

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.

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.

  • Node.js – Version 0.8.9 (32 bit version) . Make sure you download the x86 version and not the x64 version. You might have to uninstall your current version and re-install this version to ensure compatibility.
  • Python 2.7.6 .
  • Visual C++ 2010 - the Express edition is freely available from Microsoft.
  • SQL Server Native Client 11.0 - available as Microsoft SQL Server 2012 Native Client found in the SQL Server 2012 Feature Pack .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM