I am trying to connect and query my MS SQL DB from Javascript in a browser (i.e. Chrome, NOT IE do not want to use ActiveX controls). In order to do that I found this Node library Tedious and Browserify.
Tedious provides API to connect and query MS SQL server. Browserify would walk over the dependency tree and generate a bundle.js with all dependencies.
So I tried to Browserify Tedious so that I could connect to my DB straight from my client side javascript running in the Chrome browser. The error I get is that the Socket object in the net package is undefined. Any idea why?
Edit 1
Thanks Peter for the response. Ok Browserify was a stretch.
Can I use websockets to connect and perform SQL queries in my MSSQL db? In other words, can an ODBC driver be written in JavaScript using WebSockets? I know this is going to be insecure. But this is meant for in-house only behind a firewall.
I don't believe it is possible to run tedious in a browser. Browserify is powerful, but not magical, despite the wizard mascot icon. Node.js provides filesystem, networking, and child_process APIs that are not available in the browser. In a few special cases, browserify magic can make certain things you expect to be node-only work in the browser, but generally a module will have to be pure JavaScript or JavaScript using official web browser APIs (DOM, AJAX, WebSockets, etc) to work in the browser.
This is a package that works well with browserify : https://www.npmjs.com/package/net-browserify
It's based on a websocket proxy.