Hello,
 
I'm using adodbapi to connect to a ms sql server 2005 instance. The instance is created by the PLC visualisation program Siemens WinCC.
Siemens offers a connectivity pack that allows to connect to the server and run special commands outside the standard sql domain (e.g. accessing historic data for PLC alarms and tags).
 
With the connectivity pack comes the 'WINCCOLEDBProvider.1'. One has to use this provider to get access to the special commands.
 
With a clean installation of adodbapi one get's the following error when connection to the ms sql server with 'WINCCOLEDBProvider.1':
Traceback (most recent call last):
  File "xxx\wincc.py", line 69, in connect
    database=self.database)
  File "xxx\venv\lib\site-packages\adodbapi\adodbapi.py", line 116, in connect
    raise api.OperationalError(e, message)
OperationalError: (com_error(-2147352567, 'Ausnahmefehler aufgetreten.', (0, u'ADODB.Properties', u'Ein Objekt, das dem angeforderten Namen oder dem Ordinalverw
eis entspricht, kann nicht gefunden werden.', u'C:\\Windows\\HELP\\ADO270.CHM', 1240649, -2146825023), None), u'Error opening connection to "Provider=WinCCOLEDB
Provider.1;Catalog=CC_OS_1__15_01_08_16_40_41R;    Data Source=10.1.57.50\\WINCC"')
 
The german text starting 'Ein Objekt, das dem ...' means 'An object that matches the requested name or ordinalreference, cannot be found.'.
 
By investing some time and inserting some debug code I figured that the program fails in method Connection.connect at
 
        if getIndexedValue(self.connector.Properties,'Transaction DDL').Value != 0:
                self.supportsTransactions=True
 
and if this line is commented out it fails again at
 
        self.dbms_version = getIndexedValue(self.connector.Properties,'DBMS Version').Value
 
When commenting both lines out, and thus leaving self.supportsTransactions and self.dbms_version at their defaults, the program runs and I did not come accross any problems.
 
I was fine till now by locally patching adodbapi's Connection.connect to:
 
        try:
            if getIndexedValue(self.connector.Properties,'Transaction DDL').Value != 0:
                self.supportsTransactions=True
        except pywintypes.com_error:
            pass
        self.dbms_name = getIndexedValue(self.connector.Properties,'DBMS Name').Value
        try:
            self.dbms_version = getIndexedValue(self.connector.Properties,'DBMS Version').Value
        except pywintypes.com_error:
            pass
 
But, as I am now thinking about rolling out the program on a server, I'm starting to get unhappy with this (temporary) solution.
 
Likely this is a problem of the WinCC provider. However, maybe there is an elegant way to handle missing connector.Properties of certain providers in adodbapi?
 
CPython 2.7
Windows 7 32-bit
adodbapi (2.6.0.7)
pywin32 (219)
 
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to