Connection fails against SQL Server 2016

Issue #3820 resolved
Ivan Popivanov created an issue

The error is: sqlalchemy.exc.DBAPIError: (pyodbc.Error) ('ODBC data type -150 is not supported. Cannot read column .', 'HY000') [SQL: "SELECT SERVERPROPERTY('ProductVersion')"]

The repro is: engine = sa.create_engine('mssql+pyodbc://defdsn') conn = engine.connect()

defdsn is a DSN on localhost, with trusted authentication and a database.

I tried various alternatives - everything fails. Connecting via pyodbc works, but it seems that sqlalchemey is reading some additional stuff and that fails.

It's not only me - the issue is also reported on stackoverflow: http://stackoverflow.com/questions/39904693/error-odbc-data-type-150-is-not-supported-when-connecting-sqlalchemy-to-mssql

Comments (10)

  1. cryocaustik

    Same error for SQL Server 2012 and 2014. I tried using DSN and full connection string, both came back with the same error. Downgrading to v1.0.15 resolved the issue.

  2. Thomas L

    Repro'ed here as well, using mssql+pyodbc driver. This is most certainly something introduced in issue #3814, where the mssql pyodbc driver got its own impl of _get_server_version_info(...), doing the SELECT SERVERPROPERTY('ProductVersion').

    For random googlers coming here: fix this issue by downgrading to 1.0.15 - pip uninstall SQLAlchemy and pip install SQLAlchemy==1.0.15.

  3. Mike Bayer repo owner

    ATTENTION EVERYONE: PLEASE test this bug RIGHT NOW, IMMEDIATELY, as I would like to release right now, thanks!

  4. Thomas L

    @zzzeek Using HEAD seems to work fine and dandy for me, using SQL Server 2014. Thanks for the short response time.

  5. Log in to comment