Database Connection
Advanced SQL Server Administrators may define ("hard-code") a set of TCP/IP ports for SQL Server to run over the network. However, Microsoft now recommends to run the "SQL Server Browser" service which can be done either in the Services panel or the SQL Server Configuration Manager.
For more information, read: How to: Configure Express to accept remote connections
The connection string syntax is:
jdbc:sqlserver://<dbServer>:<dbPortNumber>;databasename=<dbName>
To connect to a named SQL server instance other than the default:
- If the SQL Server browser service is running:
- If the named instance is configured to listen on dynamic ports:
In the installer, specify only the instance name (in the format HOSTNAME\INSTANCENAME) and no port (the port field should be left empty), such as:
jdbc:sqlserver://localhost\sqlexpress;databaseName=MM; - If the named instance is configured to listen on static IP ports:
The SQL Server instance must be configured to run on a static TCP/IP port and that port must be specified in the installer, such as:
jdbc:sqlserver://localhost\sqlexpress:1433;databaseName=MM;
- If the named instance is configured to listen on dynamic ports:
- If the SQL Server browser service is not running:
In the installer, specify only the instance port, such as:
jdbc:sqlserver://localhost:1433;databaseName=MM;
To connect to SQL Server using domain account:
- Find the mssql JDBC driver under $MM_HOME/java/jdbc/mssql, e.g. mssql-jdbc-7.4.1.jre11.jar.
- Download a Microsoft JDBC driver for SQL Server with the same version, e.g. 7.4, and extract the content. There you will find a sqljdbc_auth.dll from Microsoft JDBC driver x.x for SQL Server\sqljdbc_x.x\enu\auth\x64, and a mssql-jdbc-x.x.x.jre11.jar from Microsoft JDBC driver x.x for SQL Server\sqljdbc_x.x\enu
- Copy the sqljdbc_auth.dll to $MM_HOME/bin and replace the mssql-jdbc-x.x.x.jre11.jar under $MM_HOME/java/jdbc/mssql with the one from Microsoft JDBC driver x.x for SQL Server\sqljdbc_x.x\enu
- At the Configure Database Connection window append the string ;integratedSecurity=true at the end of the Database url, such as jdbc:sqlserver://localhost:1433;databasename=MM;integratedSecurity=true. Specify other fields and click TEST CONNECTION.
Note 1: The default database instance name for SQL Server Express is "sqlexpress", and "sqlserver" for any other SQL Server edition.
Note 2: The default SQL Server TCP/IP port number is 1433.