简体   繁体   中英

msnodesql on WIndows 8 with VS 2012 and SQL Server 2012

I have a small node.js app working on windows 7 that retrieved data successfully from a SQL Server 2008 database.

I recently got a new computer and installed windows 8, with VS 2012, and SQL Server 2012. I installed the latest version of node. I went to install the node sql driver and I found that there was an installer for it at http://www.microsoft.com/en-us/download/details.aspx?id=29995

I downloaded the latest version (0.2.1-v0.8) and ran this installer. I run the app and it doesn't connect nor gives me an error.

I tried doing the install the "old fashioned" way as is recommended on github : https://github.com/WindowsAzure/node-sqlserver and this too did not seem to work. (Which means I had to install VS 2010 and Python.)

Is this sql driver supported on windows 8 (64 bit)?

If anybody has any advice, I'm willing to try just about anything.

UPDATE: I tried this in a new node project which I started from scratch and after following the instructions to install the msnodesql driver from npm, I got it to work.

I think on my initial steps to build the driver, something must have went wrong. Here are the steps that I followed to retrieve data from the SQL db on Windows 8 using SQL Server:

  1. npm install msnodesql
  2. Went to the .\\node_modules\\msnodesql directory for the project
  3. node-gyp configure
  4. node-gyp build
  5. Then copied the sqlserver.node file from the build\\Release directory within the msnodesql directory to the lib directory
  6. Use the module as normal

Sure.. This is what the instructions are on the git page... Maybe I ran the build from a different directory.. or just did something stupid... But Windows 8 can run msnodesql without a problem.

Install Node 0.6.20

In Azure Powershell:

..node>New-AzureServiceProject AzureNode
..node\AzureNode>Add-AzureNodeWorkerRole NodeServer
..node\AzureNode>npm install express -g
..node\AzureNode\Webrole1>npm install node-gyp 
..node\AzureNode\Webrole1>express
..node\AzureNode\Webrole1>Y
..node\AzureNode\Webrole1>del server.js
..node\AzureNode\Webrole1>ren app.js server.js

Download msnodesql-0.2.1-v0.6-ia32.msi from here: MSNodeSQL v0.6 to

..node\AzureNode\Webrole1\node-modules\ 

Run the msi and the remove it after

..node\AzureNode\Webrole1\node-modules\msnodesql>node-gyp configure

..node\AzureNode\Webrole1>npm install

Replace server.js with your code (current gets corrupt)

..node\AzureNode\Webrole1>node server.js

ENJOY!

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