Tutorials  /  Data Management  /  Connect Data

How to connect to CARTO from external applications using Tableau

Connecting to CARTO from external applications using Tableau.

This tutorial shows to connect to the CARTO database using the ODBC connection. We would strongly recommend reading the SQL direct connection article to know more about this feature before reading this one.

Introduction

With the CARTO Direct SQL Connection feature, you can use the data stored in your CARTO database in your Tableau reports and dashboards.

Tested environments

  • Windows 10 64 bits
  • Tableau Desktop 2020 64 bits with PostgreSQL driver (installation option set by default)

Configuration

Connection with Tableau must be done using ODBC or JDBC connectors. The PostgreSQL connector from Tableau does not support validation using client certificates.

Connnection using ODBC

  • Follow the steps for adding an ODBC System DSN pointing to the CARTO database that are explained in this article
  • Open up Tableau Desktop and select More...Other Databases (ODBC).

odbc_open_desktop

  • Select the DSN created in step 1. Click “Connect” and then click “Sign In”.

odbc_other_databases

  • Tableau may suggest using a data extract because some features are not supported with the ODBC driver. We also recommend creating an extract to improve overall performance. The downside of the “extract” is that must be refreshed whereas a “live” connection will to remain up-to-date.

  • Select the schema containing your datasets (identified by your username) by clicking in the search icon in the Schema dropdown.

odbc_select_schema

  • Then we need to select the table by clicking in the search icon for tables to retrieve the list of tables in the current schema

odbc_select_table

  • Drag the table(s) that you want to use in your dashboard to the right. Select “Live” or “Extract” connection” and click “Update Now” to show a preview of your CARTO dataset.

  • Then go to your worksheet, configure your visualizations and add the sheet to your dashboard.

Connnection using JDBC

  • Install the Java Runtime Environment 8 or newer
  • Copy the PostgreSQL driver (JAR file) to the “C:\Program Files\Tableau\Drivers” folder
  • Create a “.properties” file with the following connection parameters (the private key file must be the DER PKCS #8 version, with “.pk8” extension and this example assumes that you have copied the files to the C:\Certs folder):
ssl=True
sslmode=verify-full
sslcert=c:/certs/client.crt
sslkey=c:/certs/client.key.pk8
sslrootcert=c:/certs/server_ca.pem
  • Open up Tableau Desktop and select More...Other Databases (JDBC).

jdbc_open_desktop

  • Enter the JDBC URL for connecting with your PostgreSQL database specifying server, port and database name. Enter your username and password (API key) and browse your filesystem and select the Properties file created in step 3. Click Sign In.

jdbc_other_databases

  • Tableau may suggest using a data extract because some features are not supported with the ODBC driver. We also recommend creating an extract to improve overall performance. The downside of the “extract” is that must be refreshed whereas a “live” connection will to remain up-to-date.

  • Select the Schema containing your datasets (identified by your username)

jdbc_select_schema

  • Drag the table(s) that you want to use in your dashboard to the right. Select “Live” or “Extract” connection” and click “Update Now” to show a preview of your CARTO dataset.

  • Then go to your worksheet, configure your visualizations and add the sheet to your dashboard.