Thread: query a LDAP server from MS SQL
08-05-03, 10:27 #1Registered User
- Join Date
- Aug 2003
Unanswered: query a LDAP server from MS SQL
I try to connect to a LDAP server from SQL query analyzer with the following string
(SELECT * FROM OPENQUERY
(ADSI,'SELECT * FROM ''LDAP://DC=test-02,DC=test,CD=no'' '))
This resulted in a error meesage:
Server: Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing a query for execution against OLE DB provider 'ADSDSOObject'.
OLE DB error trace [Non-interface error: OLE DB provider ADSDSOObject returned DBPROP_STRUCTUREDSTORAGE without DBPROPVAL_OO_BLOB being supported].
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prepare returned 0x80040e14].
What is the problem ? It is something wrong with my db-setup, the query or what ? I try to do the same thing in a VB-program and that worked fine.
08-05-03, 13:34 #2Registered User
- Join Date
- Oct 2001
- Naples, FL
Did you setup the linked server?
exec sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces', 'ADSDSOObject', 'adsdatasource'
instead of select * try and name them to see if you can at least return something
SELECT [Name],SN[Last Name]
FROM OPENQUERY( ADSI,
'SELECT Name,SN FROM ''LDAP://DC=test-02,DC=test,CD=no'' ')
also, if objects are in containers you can specify the container name by CN= or if in OU's - OU=
if you are only wanting users you can specify
WHERE objectCategory = ''Person'' AND objectClass = ''user''
Ray Higdon MCSE, MCDBA, CCNA