Обсуждение: Doing an LDAP lookup from a SQL SELECT

Поиск
Список
Период
Сортировка

Doing an LDAP lookup from a SQL SELECT

От
David R Robison
Дата:
I have an LDAP directory that contains contact information and a
PostgreSQL table that has contact names. What I want to do is write a
SELECT that will join the names in the table with the data in the LDAP
directory (such as phone number, e-mail address, etc). Is this possible?
Has anyone done this before?
TNX in advance. David

--

David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: drrobison@openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579








Re: Doing an LDAP lookup from a SQL SELECT

От
Magnus Hagander
Дата:
David R Robison wrote:
> I have an LDAP directory that contains contact information and a
> PostgreSQL table that has contact names. What I want to do is write a
> SELECT that will join the names in the table with the data in the LDAP
> directory (such as phone number, e-mail address, etc). Is this possible?
> Has anyone done this before?

Take a look at dblink-ldap, available on pgFoundry. It's not exactly
polished :-), but it works for a lot of cases. I've used it for doing
exactly what you're trying to do here.

//Magnus


Re: Doing an LDAP lookup from a SQL SELECT

От
David R Robison
Дата:
Thanks, I found the extension but no documentation on how to install it or use it. Can you give me some pointers? TNX David

Magnus Hagander wrote:
David R Robison wrote: 
I have an LDAP directory that contains contact information and a
PostgreSQL table that has contact names. What I want to do is write a
SELECT that will join the names in the table with the data in the LDAP
directory (such as phone number, e-mail address, etc). Is this possible?
Has anyone done this before?   
Take a look at dblink-ldap, available on pgFoundry. It's not exactly
polished :-), but it works for a lot of cases. I've used it for doing
exactly what you're trying to do here.

//Magnus

 

-- 

David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: drrobison@openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579

This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.  If you are not the intended recipient, you should immediately stop reading this message and delete it from all computers that it resides on. Any unauthorized reading, distribution, copying or other use of this communication (or its attachments) is strictly prohibited.  If you have received this communication in error, please notify us immediately.  


Re: Doing an LDAP lookup from a SQL SELECT

От
David R Robison
Дата:
I copied the file to the "lib" directory under the PostgreSQL install and ran the SQL command:

CREATE FUNCTION ldap_search(text, text, text, text,text,text) RETURNS SETOF RECORD AS 'libdblink-ldap.dll', 'pg_ldap_search' LANGUAGE C STABLE;

it gave me the following error:

ERROR: incompatible library "C:/Program Files/PostgreSQL/8.2/lib/libdblink-ldap.dll": missing magic block
SQL state: XX000
Hint: Extension libraries are required to use the PG_MODULE_MAGIC macro.

any thoughts? TNX David

David R Robison wrote:
Thanks, I found the extension but no documentation on how to install it or use it. Can you give me some pointers? TNX David

Magnus Hagander wrote:
David R Robison wrote: 
I have an LDAP directory that contains contact information and a
PostgreSQL table that has contact names. What I want to do is write a
SELECT that will join the names in the table with the data in the LDAP
directory (such as phone number, e-mail address, etc). Is this possible?
Has anyone done this before?   
Take a look at dblink-ldap, available on pgFoundry. It's not exactly
polished :-), but it works for a lot of cases. I've used it for doing
exactly what you're trying to do here.

//Magnus

 

-- 

David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: drrobison@openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579

This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.  If you are not the intended recipient, you should immediately stop reading this message and delete it from all computers that it resides on. Any unauthorized reading, distribution, copying or other use of this communication (or its attachments) is strictly prohibited.  If you have received this communication in error, please notify us immediately.  



-- 

David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: drrobison@openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579

This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.  If you are not the intended recipient, you should immediately stop reading this message and delete it from all computers that it resides on. Any unauthorized reading, distribution, copying or other use of this communication (or its attachments) is strictly prohibited.  If you have received this communication in error, please notify us immediately.  


Re: Doing an LDAP lookup from a SQL SELECT

От
Magnus Hagander
Дата:
IIRC the binary release that's on there is too old to be supported on
recent versions of PostgreSQL. You will need to build it from source,
which should be patched with the magic block.

//Magnus

David R Robison wrote:
>  I copied the file to the "lib" directory under the PostgreSQL install
> and ran the SQL command:
>
> CREATE FUNCTION ldap_search(text, text, text, text,text,text) RETURNS
> SETOF RECORD AS 'libdblink-ldap.dll', 'pg_ldap_search' LANGUAGE C STABLE;
>
> it gave me the following error:
>
> ERROR: incompatible library "C:/Program
> Files/PostgreSQL/8.2/lib/libdblink-ldap.dll": missing magic block
> SQL state: XX000
> Hint: Extension libraries are required to use the PG_MODULE_MAGIC macro.
>
> any thoughts? TNX David
>
> David R Robison wrote:
>> Thanks, I found the extension but no documentation on how to install
>> it or use it. Can you give me some pointers? TNX David
>>
>> Magnus Hagander wrote:
>>> David R Robison wrote:
>>>
>>>> I have an LDAP directory that contains contact information and a
>>>> PostgreSQL table that has contact names. What I want to do is write a
>>>> SELECT that will join the names in the table with the data in the LDAP
>>>> directory (such as phone number, e-mail address, etc). Is this possible?
>>>> Has anyone done this before?
>>>>
>>> Take a look at dblink-ldap, available on pgFoundry. It's not exactly
>>> polished :-), but it works for a lot of cases. I've used it for doing
>>> exactly what you're trying to do here.
>>>
>>> //Magnus
>>>
>>>
>>>
>>
>> --
>>
>> David R Robison
>> Open Roads Consulting, Inc.
>> 708 S. Battlefield Blvd., Chesapeake, VA 23322
>> phone: (757) 546-3401
>> e-mail: drrobison@openroadsconsulting.com <mailto:drrobison@openroadsconsulting.com>
>> web: http://openroadsconsulting.com
>> blog: http://therobe.blogspot.com
>> book: http://www.xulonpress.com/book_detail.php?id=2579
>>
>> This e-mail communication (including any attachments) may contain confidential and/or privileged material intended
solelyfor the individual or entity to which it is addressed.  If you are not the intended recipient, you should
immediatelystop reading this message and delete it from all computers that it resides on. Any unauthorized reading,
distribution,copying or other use of this communication (or its attachments) is strictly prohibited.  If you have
receivedthis communication in error, please notify us immediately.   
>>
>>
>>
>>
>
> --
>
> David R Robison
> Open Roads Consulting, Inc.
> 708 S. Battlefield Blvd., Chesapeake, VA 23322
> phone: (757) 546-3401
> e-mail: drrobison@openroadsconsulting.com <mailto:drrobison@openroadsconsulting.com>
> web: http://openroadsconsulting.com
> blog: http://therobe.blogspot.com
> book: http://www.xulonpress.com/book_detail.php?id=2579
>
> This e-mail communication (including any attachments) may contain confidential and/or privileged material intended
solelyfor the individual or entity to which it is addressed.  If you are not the intended recipient, you should
immediatelystop reading this message and delete it from all computers that it resides on. Any unauthorized reading,
distribution,copying or other use of this communication (or its attachments) is strictly prohibited.  If you have
receivedthis communication in error, please notify us immediately.   
>
>
>
>
>


Re: Doing an LDAP lookup from a SQL SELECT

От
David R Robison
Дата:
I cannot seem to create an environment to recompile the DLL. Does anyone have a compiled version of the DLL that is compatible with PostgreSQL 8.2 that they can share with me?
TNX David

Magnus Hagander wrote:
IIRC the binary release that's on there is too old to be supported on
recent versions of PostgreSQL. You will need to build it from source,
which should be patched with the magic block.

//Magnus

David R Robison wrote: 
 I copied the file to the "lib" directory under the PostgreSQL install
and ran the SQL command:

CREATE FUNCTION ldap_search(text, text, text, text,text,text) RETURNS
SETOF RECORD AS 'libdblink-ldap.dll', 'pg_ldap_search' LANGUAGE C STABLE;

it gave me the following error:

ERROR: incompatible library "C:/Program
Files/PostgreSQL/8.2/lib/libdblink-ldap.dll": missing magic block
SQL state: XX000
Hint: Extension libraries are required to use the PG_MODULE_MAGIC macro.

any thoughts? TNX David

David R Robison wrote:   
Thanks, I found the extension but no documentation on how to install
it or use it. Can you give me some pointers? TNX David

Magnus Hagander wrote:     
David R Robison wrote:        
I have an LDAP directory that contains contact information and a
PostgreSQL table that has contact names. What I want to do is write a
SELECT that will join the names in the table with the data in the LDAP
directory (such as phone number, e-mail address, etc). Is this possible?
Has anyone done this before?            
Take a look at dblink-ldap, available on pgFoundry. It's not exactly
polished :-), but it works for a lot of cases. I've used it for doing
exactly what you're trying to do here.

//Magnus

        
-- 

David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: drrobison@openroadsconsulting.com <mailto:drrobison@openroadsconsulting.com>
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579

This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.  If you are not the intended recipient, you should immediately stop reading this message and delete it from all computers that it resides on. Any unauthorized reading, distribution, copying or other use of this communication (or its attachments) is strictly prohibited.  If you have received this communication in error, please notify us immediately.  


     
-- 

David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: drrobison@openroadsconsulting.com <mailto:drrobison@openroadsconsulting.com>
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579

This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.  If you are not the intended recipient, you should immediately stop reading this message and delete it from all computers that it resides on. Any unauthorized reading, distribution, copying or other use of this communication (or its attachments) is strictly prohibited.  If you have received this communication in error, please notify us immediately.  



   
 

-- 

David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: drrobison@openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579

This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.  If you are not the intended recipient, you should immediately stop reading this message and delete it from all computers that it resides on. Any unauthorized reading, distribution, copying or other use of this communication (or its attachments) is strictly prohibited.  If you have received this communication in error, please notify us immediately.