question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to connect to localhost:1433 - Could not connect (sequence)

See original GitHub issue

Issue type: [X ] question

Database system/driver: [X] mssql

TypeORM version: [X] latest

Hi everyone,

I’m new to typeorm. For now, I’m trying to connect to my local sql server which is:

Server name: .\SQLEXPRESS Port: 1433 (default)

This is my configuration file (ormconfig.json):

{
   "type": "mssql",
   "host": "localhost",
   "port": 1433,
   "username": "sa",
   "password": "mypassword",
   "database": "HelloWorld",
   "synchronize": true,
   "logging": false,
   "entities": [
      "src/entity/**/*.ts"
   ],
   "migrations": [
      "src/migration/**/*.ts"
   ],
   "subscribers": [
      "src/subscriber/**/*.ts"
   ],
   "cli": {
      "entitiesDir": "src/entity",
      "migrationsDir": "src/migration",
      "subscribersDir": "src/subscriber"
   }
}

When I typed npm run start in my command prompt window, it threw me an error: Failed to connect to localhost:1433 - Could not connect (sequence)

If I connect to my database using SMSS tool, it worked normally.

I’ve tried following this solution to turn on TCP connection of my database, but it still didn’t work.

What am I doing wrong ?

Thank you.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

34reactions
shwetavwcommented, Apr 17, 2020

Hi @IbraBach,

Try below steps:

  1. First check whether you are able to connect to Sql Server Management Studio or not.
  2. If first point works then check Sql Server(InstanceName) and Sql Server Browser services should be running.
  3. If second point is also ok then check in Sql Server Network Configuration. a) TCP/IP port should be enabled (default is disabled) and right click and enabled it. b) Go to TCP/IP properties, IP Address and checlk IP1 settings (IP Address: 127.0.0.1, TCP dynamic port: Blank, Port: 1443), Rest all IPs (TCP dynamic port: Blank, Port: 1443)

Try this I hope this should work.

mssms

sqlservices

tcpip

tcpips

10reactions
redplanecommented, May 14, 2018

Finally I resolved my issue.

I forgot turning on SQL Server Browser service on my machine.

I followed those steps to turning on SQL Server Browser.

I used JetBrain DataGrip tool to try to connect to my database, it detected my port was 65269 instead of 1433.

I think this issue can be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js MSSQL tedius ConnectionError: Failed to connect to ...
Apart from setting TCP port no to 1433. If you are getting "Connection lost - Cannot call write after a stream was destroyed"...
Read more >
connectionerror: failed to connect to localhost:1433 - could not ...
First check whether you are able to connect to Sql Server Management Studio or not. If first point works then check Sql Server(InstanceName)...
Read more >
Node.js MSSQL ConnectionError: Failed to connect to ...
Today I was trying Node.js to connect to SQL Server, the connection to the sql server failed ... message: 'Failed to conncet to...
Read more >
Unable to start MSSQL Server: Server TCP provider failed to ...
Another MSSQL server uses TCP port 1433. Resolution. Connect to the server via RDP and customize TCP port for particular SQL Server version:....
Read more >
Microsoft/mssql-developers - Gitter
Connecting to SQL Server 2000 , ConnectionError ESOCKET Socket error. ... Failed to connect to localhost:1433 - Could not connect (sequence)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found