I'm trying to connect to my local postgres database via pyodbc(i'd like to use MySQL workbench to import/view a postgres schema eventually), and I can't seem to get anything to find my psqlodbc driver. I've brew install psqlodbc
, and I have the Driver and Setup files, /usr/local/lib/psqlodbcw.so
and /usr/local/lib/psqlodbca.so
, respectively.
Using the pyodbc library in python, I've tried to connect, but pyodbc can't find my driver
conn_str = (
"DRIVER={psqlodbc};"
"DATABASE=postgres;"
"UID=postgres;"
"PWD=postgres;"
"SERVER=localhost;"
"PORT=5432;"
)
conn = pyodbc.connect(conn_str)
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'psqlodbc' : file not found (0) (SQLDriverConnect)")
My ~/.odbc.ini
looks like:
1 [PostgreSQL]
2 Description = PostgreSQL driver for Unix
3 Driver = /usr/local/lib/psqlodbcw.so
4 Setup = /usr/local/lib/psqlodbca.so
El Capitan version 10.11 and i get:
file /usr/local/lib/psqlodbcw.so
/usr/local/lib/psqlodbcw.so: Mach-O 64-bit bundle x86_64
file /usr/local/lib/psqlodbca.so
/usr/local/lib/psqlodbca.so: Mach-O 64-bit bundle x86_64
Not sure what I should do from here. Could this be a configuration or symlink issue?