Directory Programming .NET

Active Directory and ADAM programming support for .NET developers
Welcome to Directory Programming .NET Sign in | Join | Help
in Search

Reasonable Size for a DB Field to Store DN?

Last post 08-28-2008, 11:01 AM by joe. 5 replies.
Sort Posts: Previous Next
  •  08-27-2008, 8:40 PM 4518

    Reasonable Size for a DB Field to Store DN?

    What's a reasonable size for a DB field to start the distinguished name?  I think AD allows up to 2056 for DN but making a DB field that supports up to that is kind of absurd.  Would 256 or 512 be enough?
  •  08-28-2008, 8:31 AM 4520 in reply to 4518

    Re: Reasonable Size for a DB Field to Store DN?

    Depends on your tree. right?  If you have a lot of sub OU's then you'll need a larger db field.  I guess if you wanted to be sure you could run through all you user objects and get the length of the longest dn and then add 50%.  Thats my suggestion anyway... 
  •  08-28-2008, 9:15 AM 4521 in reply to 4520

    Re: Reasonable Size for a DB Field to Store DN?

    My suggestion is to never store DNs externally anyway.  Always store GUIDs.

    The GUID can be used in place of the DN using the syntax <GUID=xxxxxx> and the GUID is immutable.  It is also a fixed length and fits nicely into the SQL unique identifier data type.

  •  08-28-2008, 10:14 AM 4525 in reply to 4521

    Re: Reasonable Size for a DB Field to Store DN?

    That's what I'm doing now using GUID but we're looking to support multiple domains on our application.  I could just store the domain name but the same domain can have groups with the same name, as long as they're in different OU/containers.  In AD you can achieve this by renaming an existing group to be the same as another group somewhere else, as long as you keep the pre-Windows 2000 name unique.

    That's where I'm stuck in right now and DN seem like a good way to disambiguate between groups with the same name.
  •  08-28-2008, 10:22 AM 4526 in reply to 4520

    Re: Reasonable Size for a DB Field to Store DN?

    Not a viable option for us because our software get deployed by customers who have vastly different environments.
  •  08-28-2008, 11:01 AM 4528 in reply to 4526

    Re: Reasonable Size for a DB Field to Store DN?

    It should be fine unless you are supporting non-AD directories as both AD and ADAM support GUIDs just fine.

    Otherwise, you have to make an educated guess as to what the longest DN you'll ever need to store will be.  Since there is no inherent limit on the depth of hierarchy allowed by most directories, your DNs could potentially get to be quite large.  At some point you have to just pick a maximum length you'll support.  I'm not really sure what's reasonable here.

View as RSS news feed in XML