ODBC

Requirements

  • Build: the unixODBC development files (unixodbc-dev), found with pkg-config.
  • Run: unixODBC, and the ODBC driver of the database (psqlODBC, MySQL Connector/ODBC, IBM Db2 driver…), configured in odbcinst.ini.

Connection string

odbc://dsn

dsn is the name of a data source defined in odbc.ini (or ~/.odbc.ini); the driver connects with SQLConnect, using the user name and password of the CONNECT statement.

Example ~/.odbc.ini:

[demo]
Driver     = PostgreSQL Unicode
Servername = localhost
Port       = 5432
Database   = demo

Behavior

Most features depend on the ODBC driver: autocommit, updatable cursors, data type conversions.

  • ODBC only accepts ? placeholders: precompile with -z a.
  • With psqlODBC, set the “rollback on error” option to nop (Protocol = 7.4-0), so that GixSQL, not the driver, handles the errors.
NoteTo be verified

The psqlODBC setting for “rollback on error”.