Tutorials  /  Data Management  /  Connect Data

How to connect to CARTO from external applications using pSQL

Connecting to CARTO from external applications using psql.

This tutorial shows to connect with 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 Direct SQL Connection feature, you can directly connect to your CARTO database using psql.

Configuration

Go to your terminal / command line and execute the following command:

psql "user={username} password={API key} host={hostname} port=5432 sslmode=verify-full sslcert=./certs/client.crt sslkey=./certs/client.key"

Now you can access your CARTO database as you would do with any other PostgreSQL database.

For example: exectute the next command to describe a database table:

\d {tablename}