Configuring the odbc.ini File

ODBC Data Sources are defined in the odbc.ini configuration file. The file is divided into several sections:

  • [ODBC] is optional and used to control global ODBC configuration, such as ODBC tracing.
  • [ODBC Data Sources] is required, listing DSNs and associating DSNs with a driver.
  • A section having the same name as the data source specified in the [ODBC Data Sources] section is required to configure the data source.

Here is an example odbc.ini configuration file for Linux:

[ODBC Data Sources]
Sample MapR Hive DSN 32=MapR Hive ODBC Driver 32-bit
[Sample Mapr Hive DSN 32]
Driver=/opt/mapr/hiveodbc/lib/32/libmaprhiveodbc32.so
HOST=MyHiveServer
PORT=10000

To create a data source:

  1. Open the .odbc.ini configuration file in a text editor.
  2. Add a new entry to the [ODBC Data Sources] section. Type the data source name (DSN) and the driver name.
  3. To set configuration options, add a new section having a name matching the data source name (DSN) you specified in step 2. Specify configuration options as keyvalue pairs.
  4. Save the .odbc.ini configuration file.
NOTE You can set configuration options in your odbc.ini and .mapr.hiveodbc.ini files. Configuration options set in a .mapr.hiveodbc.ini file apply to all connections, whereas configuration options set in an odbc.ini file are specific to a connection. Configuration options set in odbc.ini take precedence over configuration options set in .mapr.hiveodbc.ini.