How to Connect SQL Server to DataGrip

Galaxy Glossary

How do I connect Microsoft SQL Server to DataGrip?

Connect Microsoft SQL Server to JetBrains DataGrip by installing the SQL Server driver, supplying a valid JDBC URL, and testing with a sample query.

Sign up for the latest in SQL knowledge from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Description

Table of Contents

What does “connecting SQL Server to DataGrip” mean?

It means registering your SQL Server instance as a DataGrip data source so you can run queries, browse schemas, and use DataGrip tooling.

What prerequisites do I need?

• SQL Server host name, port (default 1433), and database name.
• Login that can SELECT from the target database.
• DataGrip 2021.1+ with Internet access to download the Microsoft JDBC driver.

How do I add the data source in DataGrip?

1. Open the Database tool window

Click +Data SourceSQL Server. DataGrip downloads the driver automatically.

2. Fill basic connection details

Host, Port, Database, User, and Password are required. Leave the URL field blank—DataGrip builds it for you.

3. Configure SSL if needed

In the Advanced tab set encrypt=true. If the server uses a self-signed cert, also set trustServerCertificate=true.

4. Test & save

Click Test Connection.Green check = success. Click OK to persist the data source.

.

What is the exact JDBC connection string syntax?

Use the pattern below when scripting or pasting directly into the URL field.

jdbc:sqlserver://HOST:PORT;databaseName=DB_NAME;encrypt=true|false;
trustServerCertificate=true|false;loginTimeout=30

Add any property accepted by the Microsoft JDBC driver, such as applicationName or socketTimeout.

How do I verify the connection?

Run a simple query on a known table.

SELECT TOP 5 id, name, email
FROM Customers
ORDER BY created_at DESC;

If rows return without error, the data source is ready.

Best-practice tips

• Use a least-privilege login that can only read the needed schemas.
• Store credentials in DataGrip’s KeePass or OS keychain.
• Name the data source after the environment, e.g., prod-sql-server.

Common mistakes and fixes

Wrong port: Leaving the port blank defaults to 1433. If your instance listens on 14330, specify it or the test will fail.

Untrusted SSL: Enabling encrypt=true without trustServerCertificate=true on self-signed setups causes handshake errors. Add the flag or import the cert.

Need an example query?

The statement below joins Orders and OrderItems to compute total quantity per order.

SELECT o.id AS order_id,
SUM(oi.quantity) AS total_items
FROM Orders o
JOIN OrderItems oi ON oi.order_id = o.id
GROUP BY o.id;

Why How to Connect SQL Server to DataGrip is important

How to Connect SQL Server to DataGrip Example Usage


-- Check recent high-value orders (> $500)
SELECT  o.id,
        c.name,
        o.order_date,
        o.total_amount
FROM    Orders   o
JOIN    Customers c ON c.id = o.customer_id
WHERE   o.total_amount > 500
ORDER BY o.order_date DESC
LIMIT 10;

How to Connect SQL Server to DataGrip Syntax


jdbc:sqlserver://<HOST>:<PORT>;databaseName=<DB_NAME>;encrypt=<true|false>;trustServerCertificate=<true|false>;loginTimeout=<seconds>

# Parameters
HOST                – SQL Server hostname or IP
PORT                – TCP port (default 1433)
DB_NAME             – Target database, e.g., ecommerce
encrypt             – true enables TLS; false sends plain text
trustServerCertificate – Set true to bypass CA validation (dev only)
loginTimeout        – Seconds to wait before aborting

Example:
jdbc:sqlserver://db.acme.com:1433;databaseName=ecommerce;encrypt=true;loginTimeout=15

Common Mistakes

Frequently Asked Questions (FAQs)

Does DataGrip auto-install the SQL Server driver?

Yes. The first time you add an SQL Server data source, DataGrip downloads the Microsoft JDBC driver automatically. You only need Internet access.

Can I use Windows authentication?

Yes. On Windows, choose the Authentication → Integrated option. Ensure you run DataGrip under a domain account that has SQL Server access.

Where are passwords stored?

By default, DataGrip encrypts passwords in ~/.DataGrip/config/jdbc-drivers or stores them in your OS keychain if enabled.

Want to learn about other SQL terms?

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.