> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

<!--
Tab options on this page. Append to the .md URL to filter:
  ?tabs=<id,...>   select specific tabs (e.g. ?tabs=nodejs,shell)
  ?allTabs=true    include every tab
  (no param)       default: one tab per tabset

Available tabs:
  other tabs: atlas, ea-database, username-password, x509, kerberos, oidc
-->

# Connect Your SQL Tool to MongoDB

Connect your SQL tool, such as Tableau, Power BI, or DBeaver to your MongoDB Atlas or [Enterprise Advanced (EA)](http://www.mongodb.com/products/self-managed/enterprise-advanced?tck=docs) database.

All three SQL Interface deployment options use the same JDBC (Java Database Connectivity) and ODBC (Open Database Connectivity) drivers, so the steps on this page are the same whether you connect to an Atlas dedicated cluster, an Atlas federated database instance, or a self-managed [Enterprise Advanced (EA)](http://www.mongodb.com/products/self-managed/enterprise-advanced?tck=docs) deployment. Configure your deployment to accept SQL connections first. To learn how, see [SQL Interface Server Setup.](https://www.mongodb.com/docs/sql-interface/connect-with-sql-composable.md#std-label-connect-with-sql-composable)

**Note:**

MongoDB officially supports [Tableau](https://www.tableau.com/) (Desktop, Server, or Cloud) and [Power BI Desktop](https://learn.microsoft.com/en-us/power-bi/fundamentals/desktop-get-the-desktop/) (Desktop and Service) with its JDBC (Java Database Connectivity) and ODBC (Open Database Connectivity) drivers. You can use the JDBC (Java Database Connectivity) and ODBC (Open Database Connectivity) drivers with other SQL-92 compatible tools, but MongoDB cannot guarantee compatibility. Test your specific SQL Interface features to confirm support.

## Connect Tableau

Connect an Atlas dedicated cluster, an Atlas federated database instance, or a self-hosted [Enterprise Advanced (EA)](http://www.mongodb.com/products/self-managed/enterprise-advanced?tck=docs) database to Tableau (Desktop or Server) using the Tableau Connector for MongoDB.

### Prerequisites

- A MongoDB database, [configured for the SQL Interface:](https://www.mongodb.com/docs/sql-interface/connect-with-sql-composable.md#std-label-connect-with-sql-composable)

  - An Atlas dedicated cluster or a self-managed [Enterprise Advanced (EA)](http://www.mongodb.com/products/self-managed/enterprise-advanced?tck=docs) deployment must run MongoDB 6.0 or later.

  - An Atlas federated database instance must be mapped to one or more data stores, and each Atlas cluster that it reads from must run MongoDB 5.0 or later. To learn more, see [Deploy a Federated Database Instance.](https://www.mongodb.com/docs/atlas/data-federation/tutorial/deploy.md#std-label-gst-deploy-adf)

* The MongoDB JDBC (Java Database Connectivity) driver. To install, see [SQL Interface Driver Setup.](https://www.mongodb.com/docs/sql-interface/install-driver.md#std-label-sql-connect-jdbc)

* [Tableau](https://www.tableau.com/) Desktop, Server, or Cloud. [SCRAM authentication](https://www.mongodb.com/docs/manual/core/security-scram/) is preferred for Tableau Server, and X.509 authentication is also supported. Tableau Cloud supports SCRAM authentication only. To learn more about supported authentication mechanisms, see [SQL Interface Authentication.](https://www.mongodb.com/docs/sql-interface/authentication.md#std-label-sql-authentication)

### Procedure

The following steps show you how to connect to MongoDB with Tableau:

1. Download the Tableau Connector for MongoDB.

   **Note:**

   Tableau Desktop and Tableau Server version 2025 and later bundle the Tableau Connector for MongoDB. If your version of Tableau already includes the connector, skip this step. To use a different version than the one bundled with Tableau, complete this step.

   For Tableau Desktop, you can also install the connector from Tableau. Search the Tableau Exchange for MongoDB SQL interface by MongoDB, then click Install and restart Tableau.

   Download the latest Tableau Connector `taco` file from the [MongoDB download center.](https://www.mongodb.com/try/download/tableau-connector/)

   Move the `taco` file into the appropriate directory for your operating system:

   - **Windows:** `C:\Users\<user>\Documents\My Tableau Repository\Connectors`

   - **MacOS:** `~/Documents/My Tableau Repository/Connectors`

   - **Linux:** `/opt/tableau/connectors`

   **Important:**

   If you download a new version of the Tableau Connector for MongoDB, delete the previous `taco` file from your `Connectors` directory to ensure that Tableau uses the latest version.

2. Get your MongoDB database connection information.

   Select the tab for your deployment type for instructions on how to get your connection information:

   ### Atlas

   Go to your Atlas dedicated cluster or federated database instance for your project.

   Click Connect.

   Select the Atlas SQL Interface option.

   Select the Tableau Connector option under the Select your driver dropdown.

   Select Tableau from the dropdown.

   Select the database you want to connect to from the Database dropdown.

   Copy your connection string and connection parameters.

   Use this information to connect with Tableau in a later step.

3. Open Tableau Desktop or Tableau Server.

4. Go to the Connect menu.

5. Select MongoDB SQL Interface by MongoDB.

   A connection modal displays.

6. Enter your database connection information:

   ### Atlas

   Enter your SQL Interface connection string you saved in a previous step.

7. Select your authentication method.

   Choose your Authentication Mechanism from the dropdown.

   For information about all supported authentication mechanisms, see [SQL Interface Authentication.](https://www.mongodb.com/docs/sql-interface/authentication.md#std-label-sql-authentication)

   ### Username and Password

   - Username: Enter your MongoDB username.

   - Password: Enter your MongoDB password.

8. Click Sign In.

### Configure Tableau Logging

To change the logging configuration for the MongoDB JDBC (Java Database Connectivity) driver, add logging properties to the `mongodb_jdbc.properties` file. The location of this file depends on your platform:

| Platform | Path |
| --- | --- |
| macOS | `~/Documents/My Tableau Repository/Datasources/mongodb_jdbc.properties``~/Documents/My Tableau Prep Repository/Datasources/mongodb_jdbc.properties` |
| Windows | `C:\Users\<username>\Documents\My Tableau Repository\Datasources\mongodb_jdbc.properties``C:\Users\<username>\Documents\My Tableau Prep Repository\Datasources\mongodb_jdbc.properties` |
| Tableau Server (RHEL) | `/var/opt/tableau/tableau_server/data/tabsvc/vizqlserver/Datasources/mongodb_jdbc.properties` Copy this file to all server nodes. |

To configure logging, add the following properties to the file:

```properties
loglevel=INFO
logdir=<path-to-log-directory>
```

The `loglevel` property sets the verbosity of the driver logs. It accepts the following values, in order of increasing verbosity: `OFF`, `SEVERE`, `WARNING`, `INFO`, `FINE`, and `FINER`. The default is `OFF`.

The `logdir` property sets the directory where the driver writes log files. The directory must already exist. If you omit `logdir` or set it to `console`, the driver writes logs to the console instead of to a file.

**Important:**

In production environments, start with the `SEVERE` log level. Raise the level only when you must diagnose an issue, because each level adds a large amount of output. At the `FINER` level, the driver logs every call that retrieves data for each cell of each result set.

To learn more about properties files in Tableau, see the [Tableau documentation.](https://help.tableau.com/current/pro/desktop/en-us/connect_customize.htm#use-a-properties-file-to-customize-a-jdbc-connection)

## Connect Power BI

Connect an Atlas dedicated cluster, an Atlas federated database instance, or a self-hosted [Enterprise Advanced (EA)](http://www.mongodb.com/products/self-managed/enterprise-advanced?tck=docs) database to Power BI using the Power BI Connector for MongoDB.

### Prerequisites

- A MongoDB database, [configured for the SQL Interface:](https://www.mongodb.com/docs/sql-interface/connect-with-sql-composable.md#std-label-connect-with-sql-composable)

  - An Atlas dedicated cluster or a self-managed [Enterprise Advanced (EA)](http://www.mongodb.com/products/self-managed/enterprise-advanced?tck=docs) deployment must run MongoDB 6.0 or later.

  - An Atlas federated database instance must be mapped to one or more data stores, and each Atlas cluster that it reads from must run MongoDB 5.0 or later. To learn more, see [Deploy a Federated Database Instance.](https://www.mongodb.com/docs/atlas/data-federation/tutorial/deploy.md#std-label-gst-deploy-adf)

* The MongoDB ODBC (Open Database Connectivity) driver. To install, see [SQL Interface Driver Setup](https://www.mongodb.com/docs/sql-interface/install-driver.md#std-label-sql-connect-odbc). To use [Direct Query](https://www.mongodb.com/docs/sql-interface/connect.md#std-label-direct-query-mode), you must install version 1.2 or later.

* [Power BI Desktop](https://learn.microsoft.com/en-us/power-bi/fundamentals/desktop-get-the-desktop/) 64 bit. Microsoft updates and releases Power BI monthly, and Atlas supports only the latest version of Power BI Desktop.

* Windows operating system. To learn the Windows OS versions that Power BI Desktop supports, see the [Microsoft documentation.](https://www.microsoft.com/en-us/download/details.aspx?id=58494)

### Procedure

The following steps show you how to connect to MongoDB with Power BI:

1. Download the Power BI Connector for MongoDB.

   Download the latest Power BI Connector `pqx` file from the [MongoDB download center.](https://www.mongodb.com/try/download/power-bi-connector/)

   **Note:**

   The Power BI Connector for MongoDB ships with Power BI Desktop. If your version of Power BI Desktop already has the MongoDB Atlas SQL connector, skip this step. To use a different version than the one bundled with Power BI Desktop, complete this step.

   Move the connector file to the following directory path:

   `C:\Users\<user>\Documents\Power BI Desktop\Custom Connectors`.

   Create this folder if it doesn't already exist.

2. Get your MongoDB database connection information.

   Select the tab for your deployment type for instructions on how to get your connection information:

   ### Atlas

   Go to your Atlas dedicated cluster or federated database instance for your project.

   Click the Connect button.

   Select the Atlas SQL Interface option.

   Select the Power BI Connector option under the Select your driver dropdown.

   Copy your connection string.

   Use this information to connect with Power BI in a later step.

3. Connect from Power BI Desktop.

   Open Power BI Desktop.

   Select Get data from the Home menu.

   Find and select the MongoDB Atlas SQL connector.

   Type `mongo` in the search bar to find the new connector.

   Select MongoDB Atlas SQL.

   Click Connect.

   Enter the URI and the database name and click OK.

   The MongoDB URI is the connection string that you copied in a previous step.

   In the Native query field, you can optionally enter a SQL query. Power BI uses the SQL query as the direct source for the data. You can also add or change the SQL query in the Power Query editor after you connect.

   Enter your Atlas User name and Password and click Connect.

   By default, users can access all namespaces that their roles and connection URI permit. If you use custom roles to restrict access, you can grant users access to additional namespaces in the Edit User menu. To learn more, see [Configure Database Users.](https://www.mongodb.com/docs/atlas/security-add-mongodb-users.md#std-label-modify-mongodb-users)

   For information about other supported authentication mechanisms, see [SQL Interface Authentication.](https://www.mongodb.com/docs/sql-interface/authentication.md#std-label-sql-authentication)

### Direct Query

Direct Query is a connection mode available with the Power BI Connector for MongoDB version 1.2 and later. To use Direct Query, you must install [MongoDB ODBC Driver](https://www.mongodb.com/try/download/odbc-driver/) version 1.2 or later. You don't need to configure a DSN.

Direct Query is an alternative to the standard Import Mode, and allows you to query your database directly. This guarantees up-to-date data but may take longer to return results.

Direct Query does not support some actions. If you try to perform an unsupported action, Power BI prompts you to switch to Import Mode.

## Connect DBeaver

Connect your Atlas dedicated cluster, Atlas federated database instance, or self-managed [Enterprise Advanced (EA)](http://www.mongodb.com/products/self-managed/enterprise-advanced?tck=docs) deployment to [DBeaver](https://dbeaver.io/) using the MongoDB JDBC (Java Database Connectivity) Driver.

### Prerequisites

- A MongoDB database, [configured for the SQL Interface:](https://www.mongodb.com/docs/sql-interface/connect-with-sql-composable.md#std-label-connect-with-sql-composable)

  - An Atlas dedicated cluster or a self-managed [Enterprise Advanced (EA)](http://www.mongodb.com/products/self-managed/enterprise-advanced?tck=docs) deployment must run MongoDB 6.0 or later.

  - An Atlas federated database instance must be mapped to one or more data stores, and each Atlas cluster that it reads from must run MongoDB 5.0 or later. To learn more, see [Deploy a Federated Database Instance.](https://www.mongodb.com/docs/atlas/data-federation/tutorial/deploy.md#std-label-gst-deploy-adf)

* [DBeaver (Community Edition).](https://dbeaver.io/download/)

* The MongoDB JDBC (Java Database Connectivity) driver. To install, see [SQL Interface Driver Setup.](https://www.mongodb.com/docs/sql-interface/install-driver.md#std-label-sql-connect-jdbc)

### Procedure

To connect from DBeaver:

1. Get your MongoDB database connection information.

   Select the tab for your deployment type for instructions on how to get your connection information:

   ### Atlas

   Go to your Atlas dedicated cluster or federated database instance for your project.

   Click the Connect button.

   Select the Atlas SQL Interface option.

   Select the JDBC Driver option under the Select your driver dropdown.

   Select the database you want to connect to from the Database dropdown.

   Copy your connection string.

   Use this information to connect with DBeaver in a later step.

2. Open your [DBeaver](https://dbeaver.io/) application.

3. Add a driver to DBeaver.

   In DBeaver, click Database and select Driver Manager from the dropdown menu.

   Click New to open the Create new driver modal.

   In the Settings tab, specify the following information:

   | Driver Name | `MongoSQL` |
   | --- | --- |
   | Class Name | `com.mongodb.jdbc.MongoDriver` |

   In the Libraries tab, click Add File and add your JDBC driver `all.jar` file.

   Click Find Class.

   Click OK. The Create new driver modal closes.

4. Create a database connection.

   In DBeaver, click Database and select New Database Connection from the dropdown menu to open the Connect to a database modal.

   From the list of databases, select the `MongoDB` database driver that you created in the previous step.

   If you don't see `MongoDB`, select the All category inside the modal.

   Click Next.

   In the Main tab, enter the following information:

   | JDBC URL | Connection string obtained from a previous step. |
   | --- | --- |
   | Username | MongoDB user authorized for the connection. |
   | Password | Password associated with the MongoDB user. |

   In the Driver properties tab, expand User Properties. Add the following key-value properties:

   | database | The name of your virtual database. |
   | --- | --- |
   | user | The MongoDB user to connect with. Not required if you entered a `Username` in the previous step. |

## Next Steps

After you connect your SQL tool to your MongoDB database, you can query your data. To learn more, see:

- [Query with MongoSQL Statements](https://www.mongodb.com/docs/sql-interface/query-with-asql-statements.md#std-label-asql-write-asql-queries)

- [Connect to and Query Data with Free SQL Tools](https://www.mongodb.com/docs/sql-interface/tutorials/connect-tutorial.md#std-label-sql-connect-tutorial)

**Note:**

To connect using a private endpoint, see [Connect to the MongoDB SQL Interface with a Private Endpoint.](https://www.mongodb.com/docs/sql-interface/connect/private-endpoint.md#std-label-sql-connect-powerbi-private-endpoint)
