# Setting up ODBC for Mac Users

Getting ODBC up and running to connect to the MariaDB server at HBS consists of four steps:

### Installing the ODBC Framework

Macs can support both unixODBC and iODBC. It is the latter framework that is typically used for most Mac OS GUI programs. Download the iODBC installer from http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/Downloads

To install iODBC:

1. After downloading iODBC, double-click on the downloaded .dmg file.
2. Double-click on the installer file, iODBC-SDK.pkg, and follow the prompts.

Note: iODBC provides a GUI administrator tool for configuring drivers and DSNs (data source names); however, this tool has some problems and, therefore, should not be used to create or manage DSNs. We will use ODBC Manager instead.

### Installing the ODBC Manager

ODBC Manager is a GUI tool for configuring drivers and creating/managing DSNs. Although one can create the required files (odbc.ini and odbcinst.ini) by hand, the GUI tool is more convenient.

Please download ODBC Manager from http://www.odbcmanager.net/.

To install the ODBC Manager:

1. After downloading ODBC Manager, double-click on the downloaded .dmg file.
2. Double-click on the installer file, ODBC Manager.pkg, and follow the prompts.

The installer places the ODBC Manager tool in the /Applications/Utilities directory.

### Installing the MariaDB ODBC Driver

The final component needed is the ODBC driver itself. This connects the ODBC Manager to the local or remote database, and thus is specific for the target database system you wish to use. Although we are using MariaDB as our relational database server, we prefer to use the MySQL ODBC Connector instead.

Please download the MySQL ODBC Connector from https://dev.mysql.com/downloads/connector/odbc/

To install the MySQL ODBC Connector:

1. After downloading MySQL ODBC Connector DMG Archive, double-click on the downloaded .dmg file.
2. Double-click on the installer file, mysql-connector-odbc-8.0.15-macos10.14-x86-64bit.pkg, and follow the prompts.

The installer places the ODBC drivers in the appropriate location on your hard drive.

### Configuring the ODBC Connection

To configure a DSN on macOS you can use the ODBC Administrator GUI.  To use ODBC Administrator first open the ODBC Administrator from the Utilities folder in the Applications folder.  From the ODBC Administrator dialog, choose the 'User DSN' and click 'Add':

Select the 'Connector/ODBC driver' and click 'OK'.  You will be presented with the 'Data Source Name (DSN)' dialog. Enter 'MariaDB' as the Data Source Name and enter an optional Description for the DSN:

Click "Add" to add a new keyword/value pair to the panel. Please configure the following connection parameters:

server = HOSTNAME
port = 3306
database = jharvard
user = jharvard
password = PASSWORD
sslmode = required
sslca = PATH_TO_SSL_CERT

noting that you will substitute "jharvard" and "PASSWORD" with your MariaDB username and password. For the other parameters such as 'HOSTNAME', please contact us at research@hbs.edu. The PATH_TO_SSL_CERT should be the location where you placed the "ca-cert.pem" on your local hard drive. If this had been placed in your home folder, the path would be "/Users/(youraccountname)/ca-cert.pem".

Modified 7/25/2019