简体   繁体   English

带有VS 2012和SQL Server 2012的Windows 8上的msnodesql

[英]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. 我有一个在Windows 7上运行的小型node.js应用程序,该应用程序已成功从SQL Server 2008数据库检索数据。

I recently got a new computer and installed windows 8, with VS 2012, and SQL Server 2012. I installed the latest version of node. 我最近有一台新计算机,并安装了Windows 8,VS 2012和SQL Server2012。我安装了最新版本的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 我去安装节点sql驱动程序,发现在http://www.microsoft.com/zh-cn/download/details.aspx?id=29995上有针对它的安装程序

I downloaded the latest version (0.2.1-v0.8) and ran this installer. 我下载了最新版本(0.2.1-v0.8)并运行了此安装程序。 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. 我尝试按照github上的建议以“老式”方式进行安装: https : //github.com/WindowsAzure/node-sqlserver ,这似乎也不起作用。 (Which means I had to install VS 2010 and Python.) (这意味着我必须安装VS 2010和Python。)

Is this sql driver supported on windows 8 (64 bit)? Windows 8(64位)是否支持此sql驱动程序?

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. 更新:我在一个新的节点项目中尝试了此操作,该项目从头开始,并且按照说明从npm安装msnodesql驱动程序之后,我开始使用它。

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: 以下是我使用SQL Server在Windows 8上从SQL数据库检索数据的步骤:

  1. npm install msnodesql npm安装msnodesql
  2. Went to the .\\node_modules\\msnodesql directory for the project 转到项目的。\\ node_modules \\ msnodesql目录
  3. node-gyp configure node-gyp配置
  4. node-gyp build node-gyp构建
  5. Then copied the sqlserver.node file from the build\\Release directory within the msnodesql directory to the lib directory 然后将sqlserver.node文件从msnodesql目录中的build \\ Release目录复制到lib目录
  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. 当然,这就是git页面上的说明。也许我从另一个目录运行了构建。或者只是做了一些愚蠢的事情。但是Windows 8可以毫无问题地运行msnodesql。

Install Node 0.6.20 安装节点0.6.20

In Azure Powershell: 在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 从此处下载msnodesql-0.2.1-v0.6-ia32.msi: MSNodeSQL v0.6

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

Run the msi and the remove it after 运行MSI,然后将其删除

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

..node\AzureNode\Webrole1>npm install

Replace server.js with your code (current gets corrupt) 用您的代码替换server.js(当前已损坏)

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

ENJOY! 请享用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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