Using the ODBC Installer Command-Line Tools

The odbc-installer and iodbc-installer command line tools allow application developers to easily install or uninstall the GemFire XD ODBC driver and to configure DSN without requiring manual modification of system odbcinst.ini and odbc.ini files.

In addition to installing or uninstalling the driver, you can use the odbc-installer or iodbc-installer tool to query the driver or data source or add and remove data sources from an existing driver configuration.

The command-line tool that you should use depends on the driver manager that you are using. Use the iodbc-installer tool with the iODBC driver manager and the odbc-installer tool with the unixODBC driver manager.

odbc-installer and iodbc-installer Tool Usage

Syntax

odbc-installer <Object> <Action> [Options]
iodbc-installer <Object> <Action> [Options]
Object
  -d driver
  -s datasource (default user DSN)
  -su user datasource
  -ss system datasource

Action
  -q query (query data source or driver)
  -a add (add data source or install driver)
  -e edit (edit data source)
  -r remove (remove data source or uninstall driver)

Options
  -n<name> (name of data source or driver)
  -t<attribute string> String of semi-colon delimited key=value pairs follows this.

Examples

Install the driver:
 
$ odbc-installer -d -a -n"GemFire XD ODBC 1.0 Driver" -t"GemFire XD ODBC 1.0 Driver;Driver=libgemfirexdodbc.dylib;Setup=libgemfirexdodbc.dylib;APILevel=2;UID=;PWD="
$ iodbc-installer -d -a -n"GemFire XD ODBC 1.0 Driver" -t"GemFire XD ODBC 1.0 Driver;Driver=libgemfirexdiodbc.dylib;Setup=libgemfirexdiodbc.dylib,APILevel=2;UID=;PWD="
Uninstall the driver:
$ odbc-installer -d -r -n"GemFire XD ODBC 1.0 Driver"
$ iodbc-installer -d -r -n"GemFire XD ODBC 1.0 Driver"
Add a data source to a driver's configuration:
$ odbc-installer -s -a -n"GemFire XD ODBC 1.0 Driver" -t"DSN=GemFire XD ODBC DSN;Description=GFXDODBCDSN"
$ iodbc-installer -s -a -n"GemFire XD ODBC 1.0 Driver" -t"DSN=GemFire XD ODBC DSN;Description=GFXDODBCDSN"
Edit an existing data source configuration:
$ odbc-installer -s -e -n"GemFire XD ODBC 1.0 Driver" -t"DSN=GemFire XD ODBC DSN; Description=GFXDODBCDSN;SERVER=127.0.0.1"
$ iodbc-installer -s -e -n"GemFire XD ODBC 1.0 Driver" -t"DSN=GemFire XD ODBC DSN; Description=GFXDODBCDSN;SERVER=127.0.0.1"
Remove a data source from an existing driver configuration:
$ odbc-installer -s -r -n"GemFire XD ODBC DSN"
$ iodbc-installer -s -r -n"GemFire XD ODBC DSN"

ODBC Installer Tool Error Codes

This section provides a reference of error codes that can be returned when executing certain commands with the ODBC Installer command-line tools.

For additional information on these error codes, you can also reference the "Diagnostics" section of individual ODBC Installer DLL API functions at http://msdn.microsoft.com/en-us/library/ms711031(v=vs.85).aspx

Error Code Command that Produces the Error Error Message and Description
ODBC_ERROR_COMPONENT_NOT_FOUND odbc-installer -d -q Component not found in registry. The installer could not find the [ODBC Drivers] section of the registry.
ODBC_ERROR_GENERAL_ERR odbc-installer -d -a -n"GemFire XD ODBC 1.0 Driver" -t"GemFire XD ODBC 1.0 Driver;Driver=libgemfirexdodbc.so; Setup=libgemfirexdodbc.so;APILevel=2;UID=;PWD=" General installer error. Try setting correct ODBCSYSINI or ODBCINSTINI or ODBCINI environment variables.
ODBC_ERROR_INVALID_KEYWORD_VALUE " " Invalid keyword-value pairs. The attribute argument contained a syntax error.
ODBC_ERROR_INVALID_PARAM_SEQUENCE " " Invalid parameter sequence.The attribute argument did not contain a list of keyword-value pairs.
ODBC_ERROR_COMPONENT_NOT_FOUND " " Component not found in registry. Incorrect ODBCSYSINI or ODBCINSTINI or ODBCINI defined.
ODBC_ERROR_COMPONENT_NOT_FOUND odbc-installer -d -r -n"GemFire XD ODBC 1.0 Driver" Component not found in registry. Incorrect ODBCSYSINI or ODBCINSTINI or ODBCINI defined.
Unknown iodbc-installer -d -q

Unknown error. Known issue only with iODBC driver manager. Less than two entries were found in the odbcinst.ini file.