Dynamic ports in the RdbSqlServer
This topic describes how to configure your rdbSqlServer module so that you can connect to a database using dynamic ports. You need to set a few properties in the module property sheet and also configure the Sql Server Browser.
Using dynamic ports with SqlServerDatabase
SqlServerDatabase supports connecting to an SQL Server Named Instance using dynamic port discovery. To configure the use of dynamic ports, the port property must be set to 0, and the instance Name parameter value corresponding to the desired Named Instance must be specified in the Extra Connection Properties.
SQL Server allows you to install multiple database instances on a single server. Each instance has a specific name that helps identify it. When connecting to a named instance of SQL Server, you have two options: you can either specify the port number associated with the named instance, or you can directly specify the instance name. If you don't provide an instance name or port number, the connection will be made to the default instance.
When SQL Server starts up and is configured to listen on dynamic ports, it checks with the operating system to find an available port and opens an endpoint for that port. To establish a connection, incoming connections need to specify the same port number. Since the port number can change each time SQL Server starts, the SQL Server Browser Service is provided to monitor the ports and redirect incoming connections to the current port for that particular instance. If a port value is not provided in the connection string, JDBC (Java Database Connectivity) takes care of discovering the port for a named instance.
To enable the dynamic port feature, you can use the SQL Server Browser to configure the named instance of the database and set the value of the TCP DYNAMIC PORTS property to 0. When connecting to an MS SQL Server instance, if the port property is set to 0, the JDBC connection is handed over to SQL Server, and the JDBC driver excludes the port number from the connection. It then signals the JDBC driver to utilize the SQL Server Browser service to locate the instance identified by the instanceName connection. You can refer to the image below for an example.

Configure the rdbSqlServer-SqlServerDatabase properties as described above and as described above. See the “rdbSqlServer-SqlServerDatabase” topic for more details.