Problems setting up initial connection?

133 views
Skip to first unread message

Sebastian Malton

unread,
Oct 3, 2016, 11:10:27 AM10/3/16
to tedious

Hello, I am trying to connect to a SQL database on the same network as I but when I try and create a connection object I get a Socket is not a constructor: TypeError error.

This is practically my code:

var Connection = require('tedious').Connection;
var dbConfig = require("./dbConfig.json");

module.exports = function ($scope, $location, SQLService, AlertService) {
    $scope.Submit = function () {
        var connection = new Connection(dbConfig);
    };
};

I get the error on the new Connection line and my config looks something like this, the values have been changed.

{
    "userName": "nokel81",
    "password": "nl4vsc54ykpPurt",
    "server": "10.10.6.6",
    "options": {
        "port": 52581,
        "database": "E1Q_API",
        "instancename": "sql2k12"
    }
}
Reply all
Reply to author
Forward
0 new messages