I'm looking for a library that allows node.js to connect to ODBC on windows. All the libraries I have found thus far seem to work with UnixODBC but not windows, can someone please suggest a library that will work with Windows?
Asked
Active
Viewed 2.3k times
23
-
Although I haven't tried it yet, node-sharp suppoesedly enables .NET dll's to be called by node.js: https://github.com/anodejs/node-sharp – ron tornambe Oct 22 '12 at 18:07
-
I guess ODBC is considered a pretty old technology... – leeand00 Oct 23 '12 at 13:38
-
I would use OLEDB in the .NET dll. – ron tornambe Oct 23 '12 at 14:27
-
So here's what I had to do...I needed to connect the odbc data source as a Linked Server in SQL Server, and then connect to SQL Server with node.js and query the linked server from there. – leeand00 Mar 17 '16 at 14:39
1 Answers
21
Although the readme only mentions UnixODBC, this project: https://github.com/wankdanker/node-odbc will actually install and work on windows.
You can install it on windows with:
npm install odbc
but you will need the various requiements for building native modules on windows:

jedigo
- 901
- 8
- 12
-
1For others, there is also: https://github.com/idobatter/node-win32ole which gives access to more than just odbc. It ALSO requires node-gyp however. – cmroanirgo Jan 22 '15 at 07:01
-
-
2Works for me. Side note: I have a 32bit driver on a 64bit machine and encountered [ERROR|IM014|Microsoft|ODBC Driver Manager|The specified DSN contains an architecture mismatch between the Driver and Application](http://stackoverflow.com/questions/21395492/error-im014-microsoftodbc-driver-manager-the-specified-dsn-contains-an-arc). Solution: Run the 32bit version of NodeJS – bgerth Jun 15 '16 at 17:46
-
1You'll likely need to rebuild odbc to work with your version of Electron. To do that, follow the steps here: https://stackoverflow.com/a/45930921/293280 – Joshua Pinter Aug 29 '17 at 04:56