Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Querying LDAP via Linked Server in SQL Server

$
0
0

Hi all

I need to query a WebLogic Embedded LDAP version 10.3 (11g) from SQL Server 2008 and I have found several posts online that describes how to query LDAP - trouble is that I can't make it work.

My setup is:

ServerA with SQL Server 2008. Server is in WorkGroupA.

ServerB with LDAP running on port 7011. Server is in WorkGroupB.

I have installed Apache Directory Studio on ServerA and from this I can access and query LDAP using "LDAPUserA" username and "LDAPPassA" password. So I know there are no firewalls between the two servers that are restricting this and I know the username/password combination works.

I have added the linked server:

exec sp_addlinkedserver 'ADSIeliasen', 'Active Directory Services 2.5', 'ADSDSOObject', 'ServerB,7011'

I have then added login information:

exec sp_addlinkedsrvlogin 'ADSIeliasen', False, null, 'LDAPUserA', 'LDAPPassA'

I believe that this makes SQL Server use LDAPUserA/LDAPPassA for all requests to this linked server. Please correct me if I am wrong :)

then I query LDAP:

SELECT * FROM OPENQUERY(ADSIeliasen, 'SELECT * FROM ''LDAP://ServerB:7011''')

And I get this error:

Msg 7321, Level 16, State 2, Line 16
An error occurred while preparing the query "SELECT * FROM 'LDAP://ServerB:7011'" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSIeliasen".

For testing purposes I have tried setting up a similar setup querying a Windows AD, where ServerC is in DomainC. In that case I could do this:

exec sp_addlinkedserver 'ADSIeliasenAD', 'Active Directory Services 2.5', 'ADSDSOObject', 'ServerC,389'
exec sp_addlinkedsrvlogin 'ADSIeliasenAD', False, null, 'DomainC\ADUserC', 'ADPassC'
SELECT * FROM OPENQUERY(ADSIeliasenAD, 'SELECT * FROM ''LDAP://ServerC:389''')

This works just fine. Now, of course at some point I will have to refine my queries, but for now I just need to see that I can get through.

So the exact same setup (I believe) for AD as for the LDAP service. I am on a server that is not in the DomainC and I am logged into SQL Server as a user that is local on ServerA, but still I can query AD because I added the credentials to the linked server. But for LDAP it fails and frankly the error message isn't much of a clue :-) I am certain of the username and password, but how do I proceed? How do I troubleshoot this?

Thanks!


eliasen, representing himself and not the company he works for.
Five times MVP and four times MCTS in BizTalk.
Blog: http://blogs.eliasen.dk/technical/


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>