Generate your admin backend: Connect to named instance of SQL Server

Feature(s) impacted

Generate your admin backend

Observed behavior

× Cannot connect to the database due to the following error:
× {“name”:“SequelizeConnectionError”,“parent”:{“message”:“Failed to connect to localhost:1433 - Could not connect (sequence)”,“code”:“ESOCKET”},“original”:{“message”:“Failed to connect to localhost:1433 - Could not connect (sequence)”,“code”:“ESOCKET”}}

Expected behavior

I am expecting to see a message indicating a successful connecction.

Failure Logs


  • Project name: FNOL_Xercor…
  • Team name: …
  • Environment name: …
  • Agent (forest package) name & version: forest-cli 3.1.0 win32-x64 node-v18.12.0
  • Database type: SQL Server 2019 (Named instance)
  • Recent changes made on your end if any: …


This error occurs because the local CLI is trying to connect to a SQL Server listening on localhost, on port 1443.

This is because by default, when installing forestadmin for the first time, it assumes that you are installing it on a development environment, with a development database.

Do you have access to such database? On which address and port is it accessible?


My company allows our customers to run our application on the current release of SQL Server and up to 2 versions back. Because of this, I often have multiple versions of SQL Server on my PC so I install each one with an explicit “Instance Name” which SQL Server then calls a “Named Instance” as opposed to a “Default Instance”. A Default Instance uses port 1433 by default. That can be changed but rarely is.

By default, a Named Instance is dynamically assigned a port# when the SQL Server services are started. It is also possible to set the port# that a Named Instance will use. I did that and I am now able to connect successfully to my desired database.

There is also an additional service that can be started that will allow a connection to a Named Instance via the default port 1433 but that requires 2 round trips to the server in order to verify the existence of the specified instance and determine its current assigned port#. In theory, I should be able to specify <instance name> in the connection string to make the connection. That didn’t work. I suspect that is because I don’t have the necessary second service running.

Here’s the create command that I was eventually able to make work:

forest projects:create "Xercor FNOL" --databaseConnectionURL "mssql://sa:XXXXXXX@localhost:65535/FNOL_Xercor" --applicationHost "localhost" --applicationPort "3310" --databaseSchema "dbo"

Notice that by providing the specific port# for the desired instance, I did not need to specify the Instance Name in the connection string.

I’m a bit disappointed that the discovery process only builds objects for the tables and not for the views and synonyms. I did some reading and found a page that discusses manually creating the necessary files to add views to my set of useable objects. That will be my next task.