question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

4.0.25 breaks queries with integer parameters against Access database

See original GitHub issue

(Prompted by this Stack Overflow question.)

  • Python version 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)]
  • pyodbc version 4.0.25
  • driver version ACEODBC.DLL Microsoft Access database engine

A change introduced in 4.0.25 seems to have broken queries with integer parameters against an Access database.

4.0.25:

existquery = """SELECT * FROM EconVars WHERE Year(ValueDate) = ?"""
params = (1999,)
crsr.execute(existquery,params)

produces

Traceback (most recent call last):
  File "C:/Users/Gord/PycharmProjects/py3pyodbc_demo/main.py", line 106, in <module>
    crsr.execute(existquery,params)
pyodbc.Error: ('HYC00', '[HYC00] [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented  (106) (SQLBindParameter)')

specifically:

main            154c-2284   EXIT  SQLBindParameter  with return code -1 (SQL_ERROR)
        HSTMT               0x000000000021EDB0
        UWORD                        1 
        SWORD                        1 <SQL_PARAM_INPUT>
        SWORD                      -25 <SQL_C_SBIGINT>
        SWORD                       -5 <SQL_BIGINT>
        SQLULEN                    0
        SWORD                        0 
        PTR                0x0000000002C46A98
        SQLLEN                     0
        SQLLEN *            0x0000000002C46A68

        DIAG [HYC00] [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented  (106) 

However, this does work:

existquery = """SELECT * FROM EconVars WHERE Str(Year(ValueDate)) = ?"""
params = (' 1999',)
crsr.execute(existquery,params)

4.0.24:

The original query works. The ODBC log shows

main            d1c-1570    EXIT  SQLBindParameter  with return code 0 (SQL_SUCCESS)
        HSTMT               0x02AA1458
        UWORD                        1 
        SWORD                        1 <SQL_PARAM_INPUT>
        SWORD                        4 <SQL_C_LONG>
        SWORD                        4 <SQL_INTEGER>
        SQLULEN                    0
        SWORD                        0 
        PTR                0x004891E8
        SQLLEN                     0
        SQLLEN *            0x004891D4 (0)

4.0.25.LOG 4.0.24.LOG

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
gordthompsoncommented, Jul 31, 2019

Fixed in 4.0.27.

1reaction
mkleehammercommented, Jul 10, 2019

@gordthompson Thanks for notifying me. It is definitely time for a build. I’ve been on a few other things for the last couple of months and really need to manage my schedule better. I will look over stuff tonight and try to make a build.

I also need to make sure I tag any issues that cause a trap with a Security label and make builds for those.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Examples of query criteria - Microsoft Support
Query criteria help you zero in on specific items in an Access database. If an item matches all the criteria you enter, it...
Read more >
"Optional feature not implemented" error with pyodbc query ...
A change introduced in pyodbc 4.0.25 appears to cause problems with queries against an Access database when those queries use integer parameters ......
Read more >
4.0 Changelog — MongoDB Manual
SERVER-53335 Queries, updates, and deletes with non-"simple" collations may miss documents when using hashed sharding. SERVER-54064 Sessions on arbiters ...
Read more >
MySQL 3.23, 4.0, 4.1 Reference Manual
Active development and support for MySQL Database Server versions 3.23, 4.0, ... 4.6.12 mysql_explain_log — Use EXPLAIN on Statements in Query Log ....
Read more >
Blackbaud CRM 4.0 New Features Guide
Masked Account Number Field in Queries ... Improved Options for Global Marriage Settings in Constituents ... NEW FEATURES FOR BLACKBAUD CRM 4.0 25...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found