JetBrains Rider 2023.2 Help

Connect to MS SQL server

Enable the Database Tools and SQL plugin

This functionality relies on the Database Tools and SQL plugin, which is bundled and enabled in JetBrains Rider by default. If the relevant features aren't available, make sure that you didn't disable the plugin.

  1. Press Control+Alt+S to open the IDE settings and then select Plugins.

  2. Open the Installed tab, find the Database Tools and SQL plugin, and select the checkbox next to the plugin name.

Official documentation and software

This topic gives you an example of how you can configure Microsoft SQL Server and create a connection to it from JetBrains Rider. If you already have Microsoft SQL Server installed and configured, consider jumping to the section that describes a creation of a database connection in JetBrains Rider.

Required settings

Microsoft SQL Server accepts TCP/IP connections on a dedicated port. By default, it is port 1433 and it is closed by the Microsoft Windows Firewall. When connecting via port, make sure that the port that you use is not closed by the Firewall.

If the SQL Server Browser is turned on, TCP/IP connection can also be established using the Microsoft SQL Server instance name.

Enable and configure the TCP/IP connection

  • Follow the official instructions to enable the protocol, check and assign a port number. Verify that other running applications do not use the same port.

    Name of the Microsoft SQL Server instance is MSSQLSERVER. By default, the port is 1433.

Connect to Microsoft SQL Server with JetBrains Rider

The following section describes configuration of JetBrains Rider on Windows, macOS, and Linux. Note that the Use Windows domain authentication checkbox is available only on Windows. To configure Windows domain authentication on macOS and Linux, refer to Connect by using Windows domain authentication.

Connect by using Kerberos

First, you need to obtain a ticket for a user. To obtain the ticket, you need to run the kinit command with the username.

Run kinit in the command prompt

  1. In the command prompt or in the terminal, run the following command:

    kinit sqlsrvkrb

    Instead of sqlsrvkrb, use your username.

  2. Enter a password for the username.

Create a data source

  1. In the Database tool window ( View | Tool Windows | Database) , click the New icon New and select Connect to Database.

  2. If you have a connection string for the database defined in your solution or elsewhere, leave the Use connection string option selected and choose Microsoft SQL Server in the Database type selector.

    Use the String selector to choose the desired connection string from your solution or type it in manually, then click Connect.

  3. You can also choose Add data source manually, click Next and select Microsoft SQL Server in the Database source selector. Follow the wizard steps to form the connection string by configuring individual options.

  4. To access all available options for the new database connection, click Database plugin icons expui manage data sources in the Database window, then click the New icon New and select Microsoft SQL Server.

  5. Click the Driver link and select the driver for your connection.

  6. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database. For a direct download link, refer to the JetBrains JDBC drivers page.

    Location for the downloaded JDBC drivers is the JetBrains Rider configuration directory.

    The Download missing driver files link

    You can also use your drivers for the database instead of the provided ones. For more information about connecting to a database with your driver, refer to Add a user driver to an existing connection.

    If there is no Download missing driver files link, then you already have the required drivers.

  7. Specify the database connection details. Alternatively, paste the JDBC URL in the URL field.

    • In Host, Instance, and Port fields, specify your connection details.

    • From the Authentication list, select Kerberos.

    • In User and Password fields, type your user credentials.

      To use no password, leave the Password field empty.

      To delete a once entered password, right-click the Password field and select Set Empty.

      the Set Empty context menu action
    • In the Database field, type the database name to which you want to connect.

  8. Ensure that the connection to the database can be established using the provided details. To do that, click the Test Connection link at the bottom of the connection details area.

    Test Connection link

    In case of any connection issues, refer to the Cannot connect to a database page.

  9. (Optional) By default, only the default database and schema are introspected and available to work with. If you also want to work with other databases and schemas, in the Schemas tab, select them for the introspection.

    Schemas tab of the Data Sources and Drivers dialog
  10. Click OK to create the data source.

  11. Find your new data source in the Database tool window (Shortcut is missing) .

    • For more information about the Database tool window, see the corresponding reference topic.

    • For more information about working with database objects in JetBrains Rider, refer to Database objects.

    • To write and run queries, open the default query console by clicking the data source and pressing F4.

    • To view and edit data of a database object, open Data editor and viewer by double-clicking the object.

Connect by using Kerberos

Windows

Connect by using SQL Server authentication

  1. In the Database tool window ( View | Tool Windows | Database), click the Data Source Properties icon The Data Source Properties icon. Alternatively, press Shift+Enter.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Microsoft SQL Server.

  3. Click the Driver link and select Microsoft SQL Server (jTds).

  4. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database. For a direct download link, refer to the JetBrains JDBC drivers page.

    Location for the downloaded JDBC drivers is the JetBrains Rider configuration directory.

    The Download missing driver files link

    You can also use your drivers for the database instead of the provided ones. For more information about connecting to a database with your driver, refer to Add a user driver to an existing connection.

    If there is no Download missing driver files link, then you already have the required drivers.

  5. In Host, Instance, and Port fields, specify your connection details. If the server name (for example, DESKTOP) does not work, replace it with the server IP address.

  6. From the Authentication list, select User & Password.

  7. In User and Password fields, specify your credentials.

  8. Ensure that the connection to the database can be established using the provided details. To do that, click the Test Connection link at the bottom of the connection details area.

    Test Connection link

    In case of any connection issues, refer to the Cannot connect to a database page.

  9. (Optional) By default, only the default database and schema are introspected and available to work with. If you also want to work with other databases and schemas, in the Schemas tab, select them for the introspection.

    Schemas tab of the Data Sources and Drivers dialog
  10. Click OK to create the data source.

  11. Find your new data source in the Database tool window (Shortcut is missing) .

    • For more information about the Database tool window, see the corresponding reference topic.

    • For more information about working with database objects in JetBrains Rider, refer to Database objects.

    • To write and run queries, open the default query console by clicking the data source and pressing F4.

    • To view and edit data of a database object, open Data editor and viewer by double-clicking the object.

Connect by using SQL Server authentication

Connect by using single sign-on for Microsoft SQL Server

If you run JetBrains Rider on Windows in the same domain as the Microsoft SQL Server database, you can use the Single-Sign On (SSO).

  1. In the Database tool window ( View | Tool Windows | Database), click the Data Source Properties icon The Data Source Properties icon. Alternatively, press Shift+Enter.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Microsoft SQL Server.

  3. Click the Driver link and select Microsoft SQL Server (jTds).

  4. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database. For a direct download link, refer to the JetBrains JDBC drivers page.

    Location for the downloaded JDBC drivers is the JetBrains Rider configuration directory.

    The Download missing driver files link

    You can also use your drivers for the database instead of the provided ones. For more information about connecting to a database with your driver, refer to Add a user driver to an existing connection.

    If there is no Download missing driver files link, then you already have the required drivers.

  5. In Host, Instance, and Port fields, specify your connection details. If the server name (for example, DESKTOP) does not work, replace it with the server IP address.

  6. From the Authentication list, select Windows credentials.

  7. Ensure that the connection to the database can be established using the provided details. To do that, click the Test Connection link at the bottom of the connection details area.

    Test Connection link

    In case of any connection issues, refer to the Cannot connect to a database page.

  8. (Optional) By default, only the default database and schema are introspected and available to work with. If you also want to work with other databases and schemas, in the Schemas tab, select them for the introspection.

    Schemas tab of the Data Sources and Drivers dialog
  9. Click OK to create the data source.

  10. Find your new data source in the Database tool window (Shortcut is missing) .

    • For more information about the Database tool window, see the corresponding reference topic.

    • For more information about working with database objects in JetBrains Rider, refer to Database objects.

    • To write and run queries, open the default query console by clicking the data source and pressing F4.

    • To view and edit data of a database object, open Data editor and viewer by double-clicking the object.

Connect by using SQL Server authentication

Connect by using Windows domain authentication

  1. In the Database tool window ( View | Tool Windows | Database), click the Data Source Properties icon The Data Source Properties icon. Alternatively, press Shift+Enter.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Microsoft SQL Server.

  3. Click the Driver link and select Microsoft SQL Server (jTds).

  4. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database. For a direct download link, refer to the JetBrains JDBC drivers page.

    Location for the downloaded JDBC drivers is the JetBrains Rider configuration directory.

    The Download missing driver files link

    You can also use your drivers for the database instead of the provided ones. For more information about connecting to a database with your driver, refer to Add a user driver to an existing connection.

    If there is no Download missing driver files link, then you already have the required drivers.

  5. In Host, Instance, and Port fields, specify your connection details. If the server name (for example, DESKTOP) does not work, replace it with the server IP address.

  6. From the Authentication list, select Domain credentials.

  7. In the Domain field, specify the domain (for example, DEVELOPMENT).

  8. In User and Password fields, specify your domain credentials. In the User field, type your domain user without the domain prefix (for example, John.Smith instead of DOMAIN\John.Smith).

    Alternatively, on the General tab, specify the connection string. Consider the following example of a full connection string:

    jdbc:jtds:sqlserver://DESKTOP:1433;domain=DEVELOPMENT;instance=MSSQLSERVER;databaseName=guest;
  9. Ensure that the connection to the database can be established using the provided details. To do that, click the Test Connection link at the bottom of the connection details area.

    Test Connection link

    In case of any connection issues, refer to the Cannot connect to a database page.

  10. (Optional) By default, only the default database and schema are introspected and available to work with. If you also want to work with other databases and schemas, in the Schemas tab, select them for the introspection.

    Schemas tab of the Data Sources and Drivers dialog
  11. Click OK to create the data source.

  12. Find your new data source in the Database tool window (Shortcut is missing) .

    • For more information about the Database tool window, see the corresponding reference topic.

    • For more information about working with database objects in JetBrains Rider, refer to Database objects.

    • To write and run queries, open the default query console by clicking the data source and pressing F4.

    • To view and edit data of a database object, open Data editor and viewer by double-clicking the object.

Connect by using SQL Server authentication

macOS and Linux

Connect by using SQL Server authentication

  1. In the Database tool window ( View | Tool Windows | Database), click the Data Source Properties icon The Data Source Properties icon. Alternatively, press Shift+Enter.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Microsoft SQL Server.

  3. Click the Driver link and select Microsoft SQL Server (jTds).

  4. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database. For a direct download link, refer to the JetBrains JDBC drivers page.

    Location for the downloaded JDBC drivers is the JetBrains Rider configuration directory.

    The Download missing driver files link

    You can also use your drivers for the database instead of the provided ones. For more information about connecting to a database with your driver, refer to Add a user driver to an existing connection.

    If there is no Download missing driver files link, then you already have the required drivers.

  5. In Host, Instance, and Port fields, specify your connection details. If the server name (for example, DESKTOP) does not work, replace it with the server IP address.

  6. From the Authentication list, select User & Password.

  7. In User and Password fields, specify your credentials.

  8. Ensure that the connection to the database can be established using the provided details. To do that, click the Test Connection link at the bottom of the connection details area.

    Test Connection link

    In case of any connection issues, refer to the Cannot connect to a database page.

  9. (Optional) By default, only the default database and schema are project and dataset are database is schema is keyspace is namespace is introspected and available to work with. If you also want to work with other databases and schemas projects and datasets databases, schemas, and shared databases databases schemas keyspaces namespaces, in the Schemas tab, select them for the introspection.

    Schemas tab of the Data Sources and Drivers dialog
  10. Click OK to create the data source.

  11. Find your new data source in the Database tool window (Shortcut is missing) .

    • For more information about the Database tool window, see the corresponding reference topic.

    • For more information about working with database objects in JetBrains Rider, refer to Database objects.

    • To write and run queries, open the default query console by clicking the data source and pressing F4.

    • To view and edit data of a database object, open Data editor and viewer by double-clicking the object.

Connect by using SQL Server authentication

Connect by using Windows domain authentication

  1. In the Database tool window ( View | Tool Windows | Database), click the Data Source Properties icon The Data Source Properties icon. Alternatively, press Shift+Enter.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Microsoft SQL Server.

  3. Click the Driver link and select Microsoft SQL Server (jTds).

  4. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database. For a direct download link, refer to the JetBrains JDBC drivers page.

    Location for the downloaded JDBC drivers is the JetBrains Rider configuration directory.

    The Download missing driver files link

    You can also use your drivers for the database instead of the provided ones. For more information about connecting to a database with your driver, refer to Add a user driver to an existing connection.

    If there is no Download missing driver files link, then you already have the required drivers.

  5. In Host, Instance, and Port fields, specify your connection details. If the server name (for example, DESKTOP) does not work, replace it with the server IP address.

  6. From the Authentication list, select Domain credentials.

  7. In the Domain field, specify the domain (for example, DEVELOPMENT).

  8. In User and Password fields, specify your domain credentials. In the User field, type your domain user without the domain prefix (for example, John.Smith instead of DOMAIN\John.Smith).

    Alternatively, on the General tab, specify the connection string. Consider the following example of a full connection string:

    jdbc:jtds:sqlserver://DESKTOP:1433;domain=DEVELOPMENT;instance=MSSQLSERVER;databaseName=guest;
  9. Ensure that the connection to the database can be established using the provided details. To do that, click the Test Connection link at the bottom of the connection details area.

    Test Connection link

    In case of any connection issues, refer to the Cannot connect to a database page.

  10. (Optional) By default, only the default database and schema are project and dataset are database is schema is keyspace is namespace is introspected and available to work with. If you also want to work with other databases and schemas projects and datasets databases, schemas, and shared databases databases schemas keyspaces namespaces, in the Schemas tab, select them for the introspection.

    Schemas tab of the Data Sources and Drivers dialog
  11. Click OK to create the data source.

  12. Find your new data source in the Database tool window (Shortcut is missing) .

    • For more information about the Database tool window, see the corresponding reference topic.

    • For more information about working with database objects in JetBrains Rider, refer to Database objects.

    • To write and run queries, open the default query console by clicking the data source and pressing F4.

    • To view and edit data of a database object, open Data editor and viewer by double-clicking the object.

Connect by using SQL Server authentication
Last modified: 17 October 2023