blue-yonder / turbodbc

Turbodbc is a Python module to access relational databases via the Open Database Connectivity (ODBC) interface. The module complies with the Python Database API Specification 2.0.
http://turbodbc.readthedocs.io/en/latest
MIT License
614 stars 86 forks source link

Option type out of range #312

Open SSASI74 opened 3 years ago

SSASI74 commented 3 years ago

hi there,

slowly getting this to work

but now the query fails with :

2021-06-17 Traceback (most recent call last): File "C:\Users\Something.conda\envs\Conda36\lib\site-packages\turbodbc\exceptions.py", line 41, in wrapper return f(*args, **kwds) File "C:\Users\Something.conda\envs\Conda36\lib\site-packages\turbodbc\cursor.py", line 131, in execute self.impl.prepare(sql) turbodbc_intern.Error: ODBC error state: HY092 native error code: 0 message: [Microsoft][ODBC Driver Manager] Option type out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Something.conda\envs\Conda36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\Something.conda\envs\Conda36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "c:\program files (x86)\microsoft visual studio\2019\enterprise\common7\ide\extensions\microsoft\python\core\debugpy__main.py", line 45, in cli.main() File "c:\program files (x86)\microsoft visual studio\2019\enterprise\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cli.py", line 430, in main run() File "c:\program files (x86)\microsoft visual studio\2019\enterprise\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cli.py", line 267, in run_file runpy.run_path(options.target, run_name=compat.force_str("main__")) File "C:\Users\Something.conda\envs\Conda36\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "C:\Users\Something.conda\envs\Conda36\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\Users\Something.conda\envs\Conda36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\Something\source\repos\Somethingelse\module2.py", line 21, in cursor.execute('SELECT StockbookNumber FROM VS_01_NewVehicleStock') File "C:\Users\Something.conda\envs\Conda36\lib\site-packages\turbodbc\exceptions.py", line 43, in wrapper raise DatabaseError(str(e)) turbodbc.exceptions.DatabaseError: ODBC error state: HY092 native error code: 0 message: [Microsoft][ODBC Driver Manager] Option type out of range Press any key to continue . . .

any ideas?

so close

xhochy commented 3 years ago

This error also pops up in rodbc and was fixed with https://github.com/r-dbi/odbc/commit/e7619aabace13be169bc9f9b2491233bd7bb87cc

@SSASI74 Do you connect to an MS Access database by any chance?

SSASI74 commented 3 years ago

no it is a Kerridge (CDK) db, this works with pyodbc but I was hoping this would be quicker.

Thanks again for your help

SSASI74 commented 3 years ago

is there a way to fix this or should i go back to pyodbc?