How can I connect to sqlite3 db using pyodbc and unixODBC?

I cannot figure out how to connect to sqlite db using pyodbc. I have a DSN, and I can easily connect to it via isql.

isql -v TEST

works like a charm however

import pyodbc
pyodbc.connect('DSN=TEST')

It produces the following error message:

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

I also tried a large number of connection string permutations in the examples at https://code.google.com/p/pyodbc/wiki/GettingStarted to no avail.

pyodbc.dataSources()

The dsn list I'm trying to connect with, with a value containing the path to libsqlite3odbc.so

I suppose I am missing something obvious, but I cannot understand that ...

EDIT: Using unixODBC 2.3.0, python 2.7.1, sqliteodbc 0.88 and pyobbc 2.1.8 EDIT: the reason I want to use pyodbc is to port to Windows and MS Access

+3
1

, , ODBC, odbcinst, ini

[ODBC]
Trace = Yes
TraceFile = /tmp/sql.log

, SQLConnect SQLDriverConnect.

0

Source: https://habr.com/ru/post/1793835/


All Articles