Open rakeshbabuseva opened 8 years ago
Now that I look at this I'm kinda surprised that anything is passed into open
. What happens if you call it with no connection string? i.e., self.__adodb_conn.Open()
or self.__adodb_conn.Open("")
? Given that there are no options to be set, it seems that it should be called without any option.
Yes, you are right, when I set the default username and password then it is working fine with the both self.__adodb_conn.Open() or self.__adodb_conn.Open(""), if I didnt set the default values it shows the error as below **
**
>>> adodb_conn = win32com.client.Dispatch("ADODB.Connection")
>>> adodb_conn.Open("")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<COMObject ADODB.Connection>", line 3, in Open
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 282, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft OLE DB Provider for ODBC Drivers', u'[Microsoft][ODBC Driver Manager] Data
source name not found and no default driver specified', None, 0, -2147467259), None)
>>> adodb_conn.Open()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<COMObject ADODB.Connection>", line 3, in Open
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 282, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft OLE DB Provider for ODBC Drivers', u'[Microsoft][ODBC Driver Manager] Data
source name not found and no default driver specified', None, 0, -2147467259), None)**
**
Yeah that makes sense---provider isn't set when uid /pwd isn't provided until that line. I'll change the open to be empty when uid and pwd are provided and push out a new version of the egg. thanks for your help troubleshooting. On Mon, Mar 14, 2016 at 11:10 PM rakeshbabuseva notifications@github.com wrote:
Yes, you are right, when I set the default username and password then it is working fine with the both _self.__adodb_conn.Open() or self.__adodbconn.Open(""), if I didnt set the default values it shows the error as below **
**
adodb_conn = win32com.client.Dispatch("ADODB.Connection") adodb_conn.Open("") Traceback (most recent call last): File "
", line 1, in File " ", line 3, in Open File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 282, in ApplyTypes result = self.oleobj.InvokeTypes(_(dispid, LCID, wFlags, retType, argTypes) + args) pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft OLE DB Provider for ODBC Drivers', u'[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified', None, 0, -2147467259), None) adodb_conn.Open() Traceback (most recent call last): File " ", line 1, in File " ", line 3, in Open File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 282, in ApplyTypes result = self.oleobj.InvokeTypes(_(dispid, LCID, wFlags, retType, argTypes) + args) pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft OLE DB Provider for ODBC Drivers', u'[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified', None, 0, -2147467259), None)** **
— You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/zakird/pyad/issues/49#issuecomment-196680199
I get the same problem when install pyad from pip install . I try to keep setting like that self.__adodb_conn.Open("") , but still doesnt work . I have default username and password set by command pyad.set_defaults(ldap_server="", username="", password="") . Please help me check this. I using version 0.5.16
I don't have much to add to the convo at this time, but I'm getting this on version 0.5.16 as well.
Figured it out-- At line 38 in adquery.py
, the Open()
function had "Provider=ADSDSOObject"
as it's parameter.
Changing the parameter to ""
allowed the code to continue as normal.
From:
def __init__(self, options={}):
self.__adodb_conn = win32com.client.Dispatch("ADODB.Connection")
if self.default_username and self.default_password:
self.__adodb_conn.Provider = u"ADsDSOObject"
self.__adodb_conn.Properties("User ID").Value = self.default_username
self.__adodb_conn.Properties("Password").Value = self.default_password
adsi_flag = ADQuery.ADS_SECURE_AUTHENTICATION | \
ADQuery.ADS_USE_ENCRYPTION
self.__adodb_conn.Properties("ADSI Flag").Value = adsi_flag
self.__adodb_conn.Properties("Encrypt Password").Value = True
self.__adodb_conn.Open("Provider=ADSDSOObject")
else:
self.__adodb_conn.Open("Provider=ADSDSOObject")
self.reset()
To:
def __init__(self, options={}):
self.__adodb_conn = win32com.client.Dispatch("ADODB.Connection")
if self.default_username and self.default_password:
self.__adodb_conn.Provider = u"ADsDSOObject"
self.__adodb_conn.Properties("User ID").Value = self.default_username
self.__adodb_conn.Properties("Password").Value = self.default_password
adsi_flag = ADQuery.ADS_SECURE_AUTHENTICATION | \
ADQuery.ADS_USE_ENCRYPTION
self.__adodb_conn.Properties("ADSI Flag").Value = adsi_flag
self.__adodb_conn.Properties("Encrypt Password").Value = True
self.__adodb_conn.Open("")
else:
self.__adodb_conn.Open("Provider=ADSDSOObject")
self.reset()
EDIT: To be clear, the solution is the same as above, but for some reason in this version the problem appears to be un-fixed.
@SectorNine50 : Can you show me completed code working with AD Search ? I tried many time , but it still does not work . This error appear or Data source name not found and no default driver specified', None, 0, -2147467259), None)** Help me please . Thanks,
Hi, I am trying to pull the users from Active directory but when i am using adquery module gives me the following error *Traceback (most recent call last): File "", line 1, in
File "", line 3, in Open
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 282, in ApplyTypes
result = self.oleobj.InvokeTypes( (dispid, LCID, wFlags, retType, argTypes) + args)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft OLE DB Service Components', u'The parameter is incorrect.', None, 0, -21470
24809), None)
and this was causing because of the statement self.__adodb_conn.Open("Provider=ADSDSOObject")** line no 38 file adquery.py(version pyad-master 0.5.15)
so, i tried by line by line code from the interpretor and replaced self.__adodb_conn.Open("ADSDSOObject") of line 38(above) then it is working fine but i havent seen this problem in pyad-0.5.14.tar.gz version , I am able to create object to the ADQuery class as shown below *>>> from pyad import