LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   LDAP use with Oracle database (http://www.linuxquestions.org/questions/linux-server-73/ldap-use-with-oracle-database-743699/)

nhay 07-29-2009 10:53 AM

LDAP use with Oracle database
 
Hi,

I have a system that has an oracle database of employees in my building. What I am trying to do is use LDAP with that database since it already contains all the entries that I would need. Is there any way for me to use the oracle database as the backend for my LDAP software? Thanks in advance for any feedback.

druuna 07-29-2009 12:37 PM

Hi,

You might want to re-think this approach (if it is at all possible....).

Using 2 databases (in this case one RDB: oracle and one directory based: ldap), while either of those can do that particular job isn't the way to go.

If ldap needs to be used, you could make a smart sql query to extract the relevant data out of oracle, edit it (automated?) and put it into an ldif formatted file for use with ldap.

Probably not what you wanted to read, but my 2c nonetheless :-)

nhay 07-29-2009 01:21 PM

Thank you for the input. I had thought about doing that actually. My boss just wanted me to find a way to use oracle with LDAP, and you always have to listen to the boss man right? :-)
Maybe I can get him to come around.

nowonmai 07-30-2009 06:26 AM

Quote:

Originally Posted by nhay (Post 3624473)
you always have to listen to the boss man right?

Yes, you listen, then you gently explain why they're wrong and how to do it properly, because that's your function.

To answer the original question...
Oracle is a Relational Database. It does well with multiple tables of related data. LDAP is based on a tree structured database... it is basically a binary tree indexed flat-file. Using Oracle as a backend to LDAP would be hugely inefficient, as Oracle simply isn't optimised for the sort of access LDAP requires.
That, and the fact that Oracle licenses are expensive, and pretty much all LDAP servers come with Sleepycat or something bundled.

nhay 08-10-2009 09:19 AM

Sorry for the late reply on this. I was wondering if anyone had an idea as to how to get the extracted data into ldif format. I can extract the data to an ldif file using spool but of course this isn't in correct ldif format. Any suggestions?

nowonmai 08-10-2009 09:38 AM

Can you give an example of the data. Situations vary wildly as to what is or is not the correct LDIF format. Schema's will be different across different systems and so on.

nhay 08-10-2009 09:47 AM

Here's an example of what I'd be looking for:

dn: cn=test,dc=example,dc=com
myname: John Doe
group: My Group
myemail: jdoe@example.com
office: Willis 545
officephone: 555 5555
cellphone: 555 1234
objectclass: employee

nowonmai 08-10-2009 09:54 AM

Do all these elements exist in the Oracle db currently? If so, a simple script in your language of choice would create the LDIF.
What LDAP server are you using?

Also, can you clarify exactly what you are trying to achieve here. Export data from Oracle to LDAP, or what?

nhay 08-10-2009 10:03 AM

What I am trying to do is extract information from the Oracle database and somehow get it into ldif format so I can update the LDAP database.

Are you asking which version of LDAP server I'm using?

nowonmai 08-10-2009 10:07 AM

No, which server... possibilities are RedHat, Fedora, Mozilla, OpenLDAP and many more.
They each import data differently.
I would also recommend getting JXplorer to help you navigate your directory.

Also, do all the elements you mention in the sample exist in the Oracle db?

Have you any familiarity with any scripting languages?

nhay 08-10-2009 10:56 AM

I'm using OpenLDAP I believe. As for the elements, I created my LDAP schema independent of the Oracle db so the information in the ldif may not exist in that exact form in the database. As for scripting languages I've only briefly worked with javascript, php, and perl.

nhay 08-10-2009 03:17 PM

I just talked with my boss and he'd like me to write this script in Perl. I've done some basic perl modules in my time but haven't gone too in depth. I'm reading up on it right now. I welcome any suggestions to point me in the right direction though :-)

Thanks in advance.

nowonmai 08-11-2009 06:29 AM

If it was me, and it was a one-off Oracle -> LDAP transfer, I'd run a simple select SQL script to a text file, and then parse this with awk to create the LDIF.

If you need to use Perl, though, you want to look at the DBD::Oracle CPAN module and DBI in general.

I'd still be interested in knowing the overarching reasoning behind what you are trying to achieve here. I get the actual things you are trying to do, but I just don't get why... not that it's any of my business, but I might be able to give some overall guidance rather than a step-by-step how-to.

nhay 08-11-2009 10:00 AM

Well we have an oracle database of the employees in my building. When a new employee comes in they are added to our systems and to the database as well. My boss wants LDAP to be used so that users can have a good way to look up information about other users in the building (office, email, etc.). What I need to do is make it so that the LDAP database updates when the oracle database updates so that this is all done automatically. I don't know if that makes it more clear or not.


All times are GMT -5. The time now is 08:58 PM.