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

Error creating connection pool. ConnectionError: Failed to connect to localhost:[port] - connect ECONNREFUSED [ip][port] #1504

Open
Julia1205 opened this issue Dec 2, 2022 · 3 comments
Labels
Q&A For non-issues. General Q&A

Comments

@Julia1205
Copy link

Julia1205 commented Dec 2, 2022

Hello,

I'm having troubles to connect a node.js app to SQL Server. I don't know why the connection is refused since the user on SQL server have, I think, all the authorizations for the app.

Here is the error :

Error creating connection pool. ConnectionError: Failed to connect to localhost:[port] - connect ECONNREFUSED 127.0.0.1:[port]
at Connection. (C:\Users[...]\node_modules\mssql\lib\tedious.js:378:25)
at Object.onceWrapper (node:events:628:26)
at Connection.emit (node:events:513:28)
at Connection.socketError (C:\Users[...]\node_modules\mssql\node_modules\tedious\lib\connection.js:531:14)
at Socket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'ESOCKET'

Can someone help me with this please ?
Thanks alot

@Julia1205 Julia1205 added the Q&A For non-issues. General Q&A label Dec 2, 2022
@MichaelSun90
Copy link
Contributor

Hi @Julia1205, Can you provide your connection configuration, so we have a bit more information to help you investigate this? I also did a quick search, people mentioned this could be caused by something else is actively running on the localhost:[port] that you are trying to connect to, which cause the ECONNREFUSED error.
By the way, have you try to connect to you server via SQL server management studio(SSMS)?

@Julia1205
Copy link
Author

Hi @MichaelSun90, the database is on local and so is the app. The port is 1433 for the database. There is no app already running on this port. If I try to connect on SSMS with the user I created for the app, I have a 233 error but with windows authentication I have access to the database.
I don't have much knowledge about servers or network, which informations do you need ?
Sorry for my english and thanks for your help !

@mShan0
Copy link
Contributor

mShan0 commented Dec 14, 2022

Hi @Julia1205, based on you getting a 233 error (Microsoft doc explaining what that is here), it may be that your database is not configured to accept remote connections. You can follow these steps here: Configure the remote access Server Configuration Option

If that doesn't work, please confirm that your user has the correct permissions to connect to the DB.

Please provide the following info so we can help you further:

Software versions

  • Tedious:
  • SQL Server:
  • Node.js:

Connection configuration:

Additional Libraries Used and Versions if applicable (e.g. node-mssql, sequelize, etc.):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Q&A For non-issues. General Q&A
Projects
None yet
Development

No branches or pull requests

3 participants