[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Distinguished Name!!!

I fear answering this question because, while I think there is a solution,
the question is one of those "How do I fit a square peg into a round
hole?" questions. Automatically generated unique IDs (like sequences in
Oracle or IDENTITY in Sybase/MS-SQL) is something you typically find in
relational databases and not in LDAP servers. The unique identifiers are
used for referential integrity and indexes required by relational
databases, and not typically used in directory-based or network-based
database structures.

It is possible to get the highest ID, but it is not easy. Pretty much your
best bet is to retrieve all the values, and iterate through them to get
the highest ID. You can't lock or reserve an ID, so if someone else
inserts the same ID while you are building your structure to add it, you
won't have unique values.

There are a number of ways around the problem. All of them will be based
on good directory server planning and application design. We often use an
indexed hash of the initial DN as a unique identifier. In cases where we
have applications relying on relational and LDAP data, we let the
relational database generate the unique identifier before we insert it
into LDAP.

thornton Prime

On Tue, 19 Sep 2000, Ravi Mittal wrote:

> Hi All,
>     I am  a database programmer switched to LDAP for this particular
> project. I want to ask u all that -
> How do I generate unique compid for copany information. The ID for all new
> entries should be generated by computer!!!
> When a new entry is inserted the program should get the last compid
> (highest) and add 1. This should be the new compid for the new entry to be
> made???
> Can any1 kindly tell me how to get the Highest/Last Compid from the LDAP
> Database
> Regards
> Ravi Mittal