mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.88k stars 562 forks source link

SystemError: <class 'pyodbc.Error'> returned a result with an error set #1100

Closed ElTav closed 1 year ago

ElTav commented 1 year ago

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:

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

https://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

gordthompson commented 1 year ago

Please provide an ODBC trace.

ElTav commented 1 year ago

Turned out to be a separate issue