1

I'm building a NodeJS app on my Mac and I need to connect to a MSSQL database.

Using the node module mssql, I'm able to connect to the server. But authentication fails because the database server requires the use of Windows Authorization or 'trustedConnection'. If I could use the Microsoft Driver for Node.js for SQL Server with mssql, I could provide a true value for 'options.trustedConnection', but that driver is Windows only.

Is there any way to do what I'm attempting? I don't see a way with the other drivers/node modules (tedious, tds, etc) to provide a connection string that would set trustedConnection to true or use Windows Authentication.

Gregir
  • 1,574
  • 5
  • 21
  • 43
  • Your question is similar to [mine](http://stackoverflow.com/questions/26923765/how-to-connect-to-sql-server-from-red-hat-6-4-via-node-js), but I don't have a solution now. – Russj Nov 17 '14 at 23:42
  • Thanks for the head's up. I missed your question in my search (maybe because of Linux vs Mac). Have been researching this and asking around like crazy and haven't found an answer either. – Gregir Nov 17 '14 at 23:51
  • 1
    Find [this](http://serverfault.com/questions/487598/ms-sql-2008-can-i-use-windows-authentication-to-connect-from-a-mac). Tried FreeTDS? – Russj Nov 18 '14 at 05:45
  • That's the best potential solution I've seen. FreeTDS itself is probably a workable solution for just making the connection from another platform, although I have the additional requirement of it being from within a NodeJS application. I found the node-freetds module, but two potential issues: 1) It requires Node v11, and I can't use that in production (currently stuck on most stable release of v10). And 2) The author lists under Issues in the GitHub readme: "(This is Beta) Memory Leaks". Still, this is a potential solution I'll keep my eye on. Thanks for letting me know. – Gregir Nov 18 '14 at 17:52

1 Answers1

0

I just successfully connected to the SQL Server from Ubuntu 14.04.

I use FreeTDS as the driver, and unxiODBC as the driver manager, node odbc as the Node.js module to connect. I think this might be used on OSX as well.

More information can see this link. I blog it, and hope can save someone else's time.

But I need to do more research because I want to use this node module mssql to connect. mssql uses tds or tedious as drivers.

Russj
  • 697
  • 1
  • 10
  • 22
  • I almost got it running, but this setup doesn't seem to be using Windows Authentication, which is required by the db server I have to connect to. Still, this is the best solution I've seen. Thanks again. – Gregir Nov 19 '14 at 17:18