Syntax:
ServerName or IPAddress,PortExample:
192.168.1.50,1433Incorrect:
192.168.1.50:1433 βlocalhost,1433or
127.0.0.1,1433If SQL Server runs on another machine in the network:
Default port example:
192.168.1.50,1433Custom port example (very common in customer environments):
192.168.1.50,50100If your SQL Server is configured with a custom static port (e.g. 50100), that port must be used.
For named instances, use:
SERVERNAME\SQLEXPRESSIn this scenario:
No port needs to be specified manually
SQL Browser (UDP 1434) is used for instance discovery
The actual database port is resolved automatically
The resolved port is often a dynamic high port (e.g. 50345)
You do not need to know or configure the dynamic port manually.
For clarity and simplicity, it is not recommended to combine named instance and fixed port in standard setups.
To ensure successful connection:
TCP/IP must be enabled in SQL Server Configuration Manager
The SQL Server port (e.g. 1433 or custom like 50100) must be open in the firewall
SQL Browser service must run when using named instances
UDP port 1434 must not be blocked (required for instance discovery)
SQL authentication must be enabled if SQL login is used
Database user permissions must be correctly configured
Problem | Possible Cause
Connection fails immediately | Colon used instead of comma between server and port
Connection timeout | Firewall blocking SQL port (1433 or custom port)
Named instance not found | SQL Browser service not running
Named instance not found | UDP port 1434 blocked (instance discovery fails)
Login failed | Incorrect credentials
Login failed | SQL authentication not enabled
Works locally but not remotely | TCP/IP disabled
Server not found | SQL Server service not running
Cannot connect to database 'X'. Switching to database 'master'. | Database offline, missing, or insufficient permissions
This message means:
The SQL Server connection itself works
But the configured target database cannot be opened
Typical reasons:
Database name is misspelled
Database was renamed or deleted
Database is set to Offline
Database is in Restoring / Recovery state
The SQL login has no permission for that database
In this case, SQL Server connects to the server but falls back to the default master database.
Always use a comma between server and port
Use custom port numbers if configured (e.g. 50100)
For named instances, use SERVERNAME\INSTANCENAME only
SQL Browser handles dynamic ports automatically
Ensure UDP 1434 is open for named instances
Correct:
192.168.1.50,50100Incorrect:
192.168.1.50:50100