Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect NodeJS with MSSQL #1972

Closed
yeehengoh opened this issue Jun 11, 2019 · 6 comments
Closed

Unable to connect NodeJS with MSSQL #1972

yeehengoh opened this issue Jun 11, 2019 · 6 comments

Comments

@yeehengoh
Copy link

Node.js Version: 12.3.1
OS: Windows
Scope: Code
Module (and version): studentWebsite

I am facing difficulties of connecting my web apps to my MSSQL database.
After compiling program in Visual Studio 2017, once starting my program, it comes out with this error.

"Error while connecting to database :- ConnectionError: Login failed for user 'mylocal'."

The Google chrome web browser appears to have the following error.
{"code":"ELOGIN","originalError":{"message":"Login failed for user 'mylocal'.","code":"ELOGIN"},"name":"ConnectionError"}
For your information, I used NodeJS version 12.3.1, Express JS with version 14.7.1, and MSSQL with version 5.1.0.

I've located my source code inside my public GITHUB as following address.
https://github.com/yeehengoh/studentNodes

In my db.js, my connection string is written as below.

const db =
{
user: "mylocal",
password: "my123",
server: "localhost\LocalDBDemo",
database: "studentData",
port: 1433
};

module.exports = db;

Not so sure is there anything wrong with my setting over here, and i've also attached the snapshot for database's SQL server authentication.

SQL_Server

Please help on that. Thanks...

@gireeshpunathil
Copy link
Member

I am not an MSSQL expert, but the abstraction for the server does not look intuitive - is it the IP address or the well known name, or the name of the DB server instance, or a combination of all these - https://www.npmjs.com/package/mssql#general-same-for-all-drivers is not very specific on this.

Having said that, in your image the server name is shown as (LocalDb)\LocalDBDemo while your string is localhost\LocalDBDemo - could this be a reason?

@gireeshpunathil
Copy link
Member

it would also be great if the GUI provides a copy button that composes a connection string from the input that we provide.

@yeehengoh
Copy link
Author

yeehengoh commented Jun 11, 2019 via email

@gireeshpunathil
Copy link
Member

@yeehengoh - were you successful with the new connection string?

@gireeshpunathil
Copy link
Member

inactive, closing

@yeehengoh
Copy link
Author

yeehengoh commented Apr 24, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants