How to connect to MS SQL server
SQL developers can rely on DataGrip when they need to connect to the SQL Server from OSX or by using Windows authentication. This tutorial covers all steps that you need for a successful SQL Server connection.
Ensure that options in SQL Server Configuration Manager are configured correctly, and the SQL Server Browser is running.
Enable TCP/IP connections.
To get information about the port for the connection, click TCP/IP. In our case, it is 1433 (a default port).
If you changed any settings, restart the server. For most situations, the restart will resolve connection problems. If you still have problems, check the TCP port configuration, or enable a remote connection to the SQL server in the server settings.
Open the Database view (Alt+2) and create a data source with the appropriate driver. In this tutorial, we assume that it is the jTds driver.
If you have no driver, click the link to download it.
Specify the host name, the instance name and the credentials. Remember that DataGrip offers completion for host, instance and database names (N/A), but the database name is optional. These fields might be familiar for users who are used to the SQL Server Management Studio (SSMS) interface, compare the following connection windows of SSMS and DataGrip.
In the jTds driver, if the port number conflicts with the instance name, the instance name takes precedence over the port number. In the Microsoft driver, the port number takes precedence over the instance name. To avoid confusion, remove the port number. If you want to specify the port number, click the Auto-set button (located to the right of the Instance field) to set the port number automatically.
If you need to use Windows authentication, you can use the Microsoft driver.
Alternatively, you can connect to the server from any other machine with Windows authentication by using the jTds driver. The jTds driver is multiplatform.
To establish the connection with the jTds driver, go to the Advanced tab of data source properties, set USENTLMV2
to true
, and specify the domain name in the DOMAIN
field.
Type your Windows credentials in User and Password fields, and click Test Connection.
If you want to select what databases or schemas to show in the Database view, go to the Schemas tab in the data source properties:
In case you use DataGrip 2016.2 and later, click More Schemas in the Database view:
All selected databases will appear in the Database view. See how it looks in SQL Server Management Studio:
And here is the look in DataGrip: