Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


For Mac only

  • Run “odbcinst -j” in your Terminal to find the correct path the unixodbc config files - specifically the “odbcinst.ini” file
    (On my system, it was in /usr/local/etc)

  • In a text editor, open odbcinst.ini and add information about the new PostgreSQL driver.

[PostgreSQL Driver]

Driver = /usr/local/lib/

Note: the name inside the square brackets [] can be anything, but you have to remember this name to call this driver later.

Note: you should look inside /usr/local/lib make sure this is the correct path to your psqlodbc driver file.

For Mac and Windows

  • In R, install and load the “DBI” and “odbc” packages

  • Check for the correct name of the PostgreSQL driver by running this command:


The name of the driver should be the same as the name you gave the driver when you edited odbcinst.ini.

Make the connection using code like the following:

con <- DBI::dbConnect(


 driver="PostgreSQL Driver",






  sslmode = "require"


Note: Insert the correct driver name returned from the previous command, as well as your correct login credentials.

Note: SSL should be On

Executing Custom SQL (more info)