dbu
dbu

Reputation: 29

Connecting to Vertica database via pyodbc without odbc.ini on RHEL6

I do not have the permission to edit the system-wide odbc.ini file, therefore I am searching for alternative ways to specify connection parameters towards Vertica.

I have unpacked the needed libraries to a certain location, and am attempting to create a connection string from my "custom" config file.

Is it possible to explicitly specify the path to the driver (and any other necessary parameters) when using pyodbc.connect?

Example intention (fails with the error below):

conn = pyodbc.connect("DRIVER=path/to/libverticaodbc.so;...")

Error:

pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')

Alternatively, is there another option to use odbc.ini files other than the ones at /etc/, e.g. through setting an environment variable?

Upvotes: 0

Views: 876

Answers (2)

elirevach
elirevach

Reputation: 404

I recommend to avoid the use of ODBC driver to connect to Vertica . Vertica release native driver for python , see attach full details and examples :

https://github.com/uber/vertica-python

I hope you will find it us-full

Thanks

Upvotes: 2

FlipperPA
FlipperPA

Reputation: 14361

You can put a file called .odbc.ini in your home directory which will be for user specific ODBC settings.

http://www.unixodbc.org/odbcinst.html

Upvotes: 1

Related Questions