hhh
hhh

Reputation: 52810

Driver for pyodbc: how to specify its location in macOS?

I want to find a way to specify the path of a driver -- or otherwise resolve problem that Pyodbc cannot find a Vertica driver -- for the following Python 3 command with Pyodbc package

Pyodbc.connect(...)

but I keep getting the error that a Vertica driver 9.0.x cannot be found. I used the installer here and the installer here on macOS.

I currently use an alias Vertica in the command but unknown for the Pyodbc connect so apparently some driver file problem, now need to find a way to resolve this.

How can I specify the location of the driver for pyodbc? Or otherwise resolve why the driver unknown?

Updated comments on TaliTedi answer.

  1. How to confirm that iODBC is up-to-date?

  2. How to build pyodbc with links to iODBC?

  3. The directory ~/Library/ODBC/odbcini does not exist. How to configure the DNSs?

enter image description here

Older pyodbc threads

  1. pyODBC: specify location of driver in Windows

Upvotes: 0

Views: 1929

Answers (1)

TallTed
TallTed

Reputation: 9434

  1. Confirm that iODBC is fully up-to-date. (Apple ships an outdated version of iODBC in macOS.)
  2. Build pyodbc with links to iODBC (not its default of UnixODBC, which is not typical for macOS).
  3. Use iODBC Administrator.app (/Applications/iODBC/) to configure ODBC Data Source Names (DSNs), which will be saved to default files:
    • System DSNs: /Library/ODBC/odbc.ini
    • User DSNs: ~/Library/ODBC/odbc.ini
  4. If pyodbc or other tools require $ODBCINI environment variable or similar settings, point them to the file(s) noted above.
  5. Enjoy.

Upvotes: 1

Related Questions