To diagnose, we usually need to know the following, including version numbers. On Windows, be
sure to specify 32-bit Python or 64-bit:
Python: 3.8
pyodbc: 4.0.32
OS: Linux 5.4.112-1.el7.elrepo.x86_64
DB: SQL Server
driver: ODBC Driver 17 for SQL Server
Issue
We our running into issues where one of our applications is consistently running into a SystemError: <class 'pyodbc.Error'> returned a result with an error set error whenever it tries to connect to one of our databases. We have other services co-located alongside it that are able to connect to the same database using the same configuration and connection string, and the database is healthy/reachable server-side
Our connection string is pretty straightforward DSN=<DB>;Trusted_Connection=yes;Database=<table>; Max Pool Size=100 and the relevant operations we're performing are as follows
import pyodbc
conn = pyodbc.connect(self._conn_str, autocommit=True, ansi=True) // Throws 'SystemError: <class 'pyodbc.Error'> returned a result with an error set' every time
conn.set_attr(
pyodbc.SQL_ATTR_TXN_ISOLATION, pyodbc.SQL_TXN_READ_UNCOMMITTED
)
conn.timeout = MSSQL_QUERY_TIMEOUT
Please first make sure you have looked at:
Environment
To diagnose, we usually need to know the following, including version numbers. On Windows, be sure to specify 32-bit Python or 64-bit:
5.4.112-1.el7.elrepo.x86_64
ODBC Driver 17 for SQL Server
Issue
We our running into issues where one of our applications is consistently running into a
SystemError: <class 'pyodbc.Error'> returned a result with an error set
error whenever it tries to connect to one of our databases. We have other services co-located alongside it that are able to connect to the same database using the same configuration and connection string, and the database is healthy/reachable server-sideOur connection string is pretty straightforward
DSN=<DB>;Trusted_Connection=yes;Database=<table>; Max Pool Size=100
and the relevant operations we're performing are as followshttps://github.com/mkleehammer/pyodbc/issues/1014 makes me think this is indeed a pyodbc issue, but this is thrown when connecting rather than executing a query