Monday, 29 May 2017

mssql having issues connecting to server

I'm trying to deploy my Reactjs app via SQL Server 2008 using IISNode. I've tested the program on the server itself running from localhost, and it works fine. However, when I try to reach the application using the web URL, the line:

(node:8084) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ConnectionError: [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'domain\serverName$'.

... shows up.

I think I maybe have to change how I'm connecting to the server, but I'm at a fair loss right now. Here is how I'm connecting to the server:

const sql = require('mssql/msnodesqlv8');
const config = {
    database: "db",
    server: "server",
    port: "1435",
    driver: "msnodesqlv8",
    parseJSON: true,
    options: {
        trustedConnection: true,
        useUTC: true
    }
};

var connection = sql.connect(config, function (err) {
    if (err) throw err;
});

I'm exporting the above to the main server.js page and then running the server.js using node.

I'm a bit of a loss of how to change my code. I'm trying to connect to another server that contains all the data that I need, to another server that hosts my web application.



via Andy Wong

No comments:

Post a Comment