Operational Error trying to connect to an SLQ Server DB
Glad you found the problem. Yes, pywin32 is required if you are running CPython. I did not check for pywin32 at import time in this version of adodbapi in order to support Iron Python, which cannot call it. I will have to drop support for Iron Python now, since Python 2 is deprecated in the pywin32 project. So this sourceforge project will become the Iron Python fork, while continued development of adodbapi will take place within the pywin32 repo.
SOLVED I did not have pywin32 installed (I found nowhere that I have to install it). After installing it, all work fine.
I've just tried using IDLE instead of Visual studio code and this is what I get after I run the connection command: >>> conn = adodbapi.connect(conn_string) Traceback (most recent call last): File "C:\Users\cattaneo.DOMAIN1\AppData\Local\Programs\Python\Python39\lib\site-packages\adodbapi\adodbapi.py", line 97, in make_COM_connecter c = Dispatch('ADODB.Connection') #connect _after_ CoIninialize v2.1.1 adamvan NameError: name 'Dispatch' is not defined During handling of the above exception, another...
Operational Error trying to connect to an SLQ Server DB
make hg repo match git repo
remove obselete files & fix line endings
Unknown column names should raise AttributeError
Named parameters fail if the sql ends on a parameter
Fixed in adodbapi 2.6.2. Thanks for reporting and analyzing this.
NOTICE: as of today, 25 November 2019, this (SourceForge mercurial) repo is no longer the definitive source for adodbapi. The source from here has been cloned to github mhammond/pywin32 ./adodbapi subfolder. An hg push from that git directory caused basically every .py file in the source to appear to have every line changed, because the end-of-line changed. Sorry. It seemed like a small price to pay. The pypi package was uploaded from that version, which should also be done in the future, for IronPython...
new version based from pywin32/adodbapi
Thank you for reporting this. I am in the process of moving the master copy of the source code a sub-directory of pywin32 so that it will not get lost when deploying there. A different version of your suggested fix has been implemented there. I used a try - except block, because, in Python, the "it's easier to get forgiveness that permission" technique saves testing for an error which will usually not happen. The resulting code is easier to read and usually runs faster. I will try to move a copy...
Named parameters fail if the sql ends on a parameter
This also happens if the procedure doesn't exist in the current database.
How to set up tests
I don't have permission to modify the status of my own bug report, it seems, but if I did I would close this ticket and withdraw the accompanying patches. For more information see https://github.com/mhammond/pywin32/pull/1165 and https://mail.python.org/pipermail/python-win32/2018-February/013994.html.
merged stop_memory_leak
use weakref to stop memory leak
preserve work for version drop
I will look at pulling your patches in very soon. My old test setup evaporated and I'm building a replacement. On Sat, Feb 17, 2018 at 10:25 AM, Bob Kline bkline@users.sourceforge.net wrote: (Having a conversation with myself, it seems). :-) And I believe the patch also addresses https://sourceforge.net/p/ adodbapi/bugs/17/ [bugs:#27] https://sourceforge.net/p/adodbapi/bugs/27/ Empty string replaced with single space on insert* Status: open Group: v1.0_(example) Created: Thu Feb 01, 2018 02:08 PM...
Here's a second patch which addresses the problem in a more general way, hopefully closer to something which could actually be applied to the repository (perhaps with some added comments). Basically, it applies the logic for trying to use ADO's existing parameter list for all calls to _buildADOparameterList(), not just for stored procedures. The original version had a comment "needed only if we are calling a stored procedure" but not explaining why that would be true. Given the incorrect behavior...
(Having a conversation with myself, it seems). :-) And I believe the patch also addresses https://sourceforge.net/p/adodbapi/bugs/17/ [EDIT: no, the patch isn't that good :-) The datetime precision bug will still need some digging.]
(Having a conversation with myself, it seems). :-) And I believe the patch also addresses https://sourceforge.net/p/adodbapi/bugs/17/
This patch appears to fix another bug I hadn't gotten around to reporting. Without the patch: >>> cursor.execute("CREATE TABLE #foo (i INT, t NTEXT NULL)") >>> cursor.execute("INSERT INTO #foo VALUES(?, ?)", (42, None)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python\lib\site-packages\adodbapi\adodbapi.py", line 885, in execute self._execute_command() File "C:\Python\lib\site-packages\adodbapi\adodbapi.py", line 697, in _execute_command self._raiseCursorError(klass,...
Here's a second patch which addresses the problem in a more general way, hopefully closer to something which could actually be applied to the repository (perhaps with some added comments). Basically, it applies the logic for trying to use ADO's existing parameter list for all calls to _buildADOparameterList(), not just for stored procedures. The original version had a comment "needed only if we are calling a stored procedure" but not explaining why that would be true. Given the incorrect behavior...
Here is a patch which demonstrates that it is possible to get the right behavior from ADO/DB. Note that this is not a full-blown solution (the patch only addresses one non-sproc path and hasn't been through regression testing), but it might point the work on this ticket in the right direction. Feedback? >>> from cdrapi import db >>> cursor = db.connect().cursor() >>> cursor.execute("CREATE TABLE #foo (s ntext)") >>> cursor.execute("INSERT INTO #foo VALUES(?)", ("",)) >>> cursor.execute("INSERT INTO...
Empty string replaced with single space on insert
The bug persists in 2.6.0.7, but only under Python 2.x. Using Python 3.x there appears to be a different bug, because sub-second precision is discarded when retrieving values from the database. Any plans for correcting these defects at some point in the (one hopes) not-too-distant future? Are patches accepted? If so, I'll look into whether it would be feasible to contribute to the fix(es).
Was it fixed just for Sql Server ? Because I had the same problem with adodbapi v2.6.0.7 and this post made my day !
Call remote with Pyro >= 4.46
Setting autocommit = False does not BeginTrans
How to connect to OLEDB in Python 3.5
PyPi
bump version
Stefan Fuchs patch: support WINCCOLEDBProvider
document .timeout connection attribute
fix is64bit on Linux
Sorry you were having trouble. Is there a way that the error message could have been...
Oops - my mistake. I've just noticed that the problem was with another field which...
Error with NULL integer fields
fix transaction counter bug (Jure Erznožnik)
Automated merge
xls write using data types
Sorry, forgot to add that this was in MS SQL Server
Invalid error without permissions to SQL Server Procedure
missed a comma
sql test db on win81
Crash executing Procedure
Thank you. My SQL server was not available, so I tested without it. I have never...
fix extra parameter in proc call
Crash executing Procedure
Queried timestamps truncated at 3 decimal places
tests with MySQL and PostgreSQL working
Crash with Keyword Parameters
Thank you. I have refactored this area.
bug fix #18 and #20
I have added code to try introspecting the object itself when the type of the object...
Problems with Non-Str-Strings
Index out of Range Error in changeNamedToQmark
Doh! I must have been tired that day. I fixed it using "easier to get forgiveness...
If you change the test on line 674 so that the parameter and field are reversed as:...
Incorrect error message / IndexError creating error message
Fixed and tested before version 2.6.0.7
Dear George: I cannot figure out how to write a regression test for this fix. Would...
Use of Win32Com Cache
The trace related to this is: File "c:\python27\lib\site-packages\adodbapi\adodbapi.py",...
Index out of Range Error in changeNamedToQmark
Crash with Keyword Parameters
Problems with Non-Str-Strings
If this resulted in a "Application uses a value of the wrong type for the current...
DateTime objects with milliseconds break
correct pypi download
update whatsnew
document 'pyformat' and 'dynamic' paramstyles
bump version strings, remove pdf from hg
bump version number
merged
pyformat paramstyle tested
correct python3 import
rebuild parameters list for prepared, too
more efficient 'named' conversion
add pyformat paramstyle
prettier status message
reuse of remote connection raises correct error
fix two ironPython bugs
more sure parameter setup for .prepare()
postgres parameters dont have names
update documentation
define .prepare() for remote
cursor.prepare() method implemented
improve formatting of quick reference
better error message for bad format connection ...
remove debug lines
autocommit tests fixed
accept datetime input for PythonTime, too
correct an always passing test