Getting group members using ldap query

I need help writing an LDAP query for iPlanet to retrieve all the members of a group. I can do it on Active Directory using the following :
(memberof=CN=SundanceGroup,CN=Users,DC=Test,DC=com)
But I am not able to do it with iPlanet. Please let me know how to do it.
Thanks,
Binu

"memberof" attribute is not supported by iPlanet. try using "uniquemember" attribute instead. Also the users in iPlanet are generally created under "ou=people" and not "cn=users". try changing ur filter as(uniquemember=CN=SundanceGroup,ou=people,DC=Test,DC=com).
BTW
does anyone know how to query different servers with a common filter to get the groups of a user.

Similar Messages

  • How to get this output using sql query?

    Hi,
      How to get this output using sql query?
    Sno Name Age ADD Result
    1 Anil 23 delhi Pass
    2 Shruti 25 bangalor Pass
    3 Arun 21 delhi fail
    4 Sonu 23 pune Pass
    5 Roji 26 hydrabad fail
    6 Anil 28 delhi pass
    Output
    Sno Name Age ADD Result
    1 Anil 23 delhi pass
    28 delhi pass

    Hi Vamshi,
    Your query is not pretty clear.
    write the select query using Name = 'ANIL' in where condition and display the ouput using Control-break statements.
    Regards,
    Kannan

  • Sum and group by using CAML query

    Is there any way to get the SUM of values with group by ID using CAML query?
    I have a custom list, in that I have ID and Value columns as below
          ID         Value1      Value2
          1             10             4
          2              5              3
          1             15             2
          3             20             1
    I want to get result:
         ID          Value1        Value2
         1             25                6
         2             5                  3
         3             20                1
    I used CAML query:
    <View>
    <Query>
    <Where>
    <IsNotNull>
    <FieldRef Name="ID" />
    </IsNotNull>
    </Where>
    <GroupBy Collapse="FALSE">
    <FieldRef Name="ID" />
    </GroupBy>
    </Query>
    <ViewFields>
    </ViewFields>
    <Aggregations Value="On">
    <FieldRef Name="Value1" Type="SUM" />
    <FieldRef Name="Value2" Type="SUM" />
    </Aggregations>
    </View>
    But
    this query returns all the records
    that satisfy the condition <Where>.
    I
    do not correctly?

    You need to work with current view based aggregation. Please check below threads for your reference.
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/dda5735a-fecf-403f-9495-1b63617d2fbf/question-on-a-caml-query?forum=sharepointdevelopmentlegacy
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/24e88d6a-ee15-4d81-a5fe-504c7bd14e46/how-to-sum-a-column-value-using-caml-query?forum=sharepointdevelopment
    Hope this helps.
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful
    I've seen these
    issues and articles and do them, but
    does not work. I use object mozhel
    Sharepoint (javascript).

  • Determining if a user is disabled in OD using LDAP query

    Hello all,
    I'm doing a LDAP query against my OD to make a web-based user directory. I'm using PHP and doing a LDAP search against 10.6 Server OD such as this:
    $sr=ldap_search($ds, "cn=users,dc=my_server,dc=private", "(CN=*)");
    The search is working perfectly, and I'm getting an array result with multiple key/values such as:
    objectclass
    uidnumber
    apple-generateduid
    apple-mcxflags
    loginshell
    etc.......
    Since it's a listing of active employees, I want to identify deactivated ones and filter them out of my listing. However, I can't see any key/values that could tell me if a user is deactivated or not.
    What would be the best way? Must I run a command line to see if a user is disabled, and if so, what command? (However, this would be poor on performance...)
    Thanks.

    I looked into this ages ago here:
    https://discussions.apple.com/message/6595575#6595575
    This information was relevant back in 10.4 which was post NetInfo.  All things being equal, this is likely still the case.  However, this may have changed and I apologize in advance for not validating.

  • Using LDAP Query in Active Directory to see what users are still logged ?

    any suggestions for a LDAP query that I can use in AD to see who is still logged into the network?
    It would be great to distinguish who's logged in with a screen lock which means they aren't really at their PC vs what users are actually using their PCs.
    Thanks in advance!

    I recently posted a framework for checking all machines to see who is logged into them. You can take that and adjust it as you need.
    https://social.technet.microsoft.com/Forums/en-US/fb2ef90a-ba15-41bf-8e6c-95d32256225b/how-do-i-run-this-query-from-a-text-file-list?forum=ITCG
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Getting manager hierarchy using LDAP

    I have a set of oracle email ids. I would like to get their manager hierarchy as well as Job title. Is this possible using LDAP. If so can someone please explain with a code snippet.
    Thanks.

    Hi 711286,
    I didn't knew you could insert data such as the manager of a person when you create a person in LDAP? At least I don't recall that.
    Anyhow you can access data in the LDAP using the DBMS_LDAP package in PL/SQL, so if the data is there you can reach it.
    The DBMS_LDAP PL/SQL Package
    Although I have to say I think this data should just be kept in your own database tables, not in the LDAP, otherwise who knows what else your going to put inthere.
    Regards,
    Joni

  • Using LDAP query to get all the domains from all the forests in my company

    Foreword:
    I'm using two domain controller (dc1 and dc2). I'm using a domain registered to the root domain dc1 and simply request all of the domains in its forest by preforming search in the CN=Partitions,CN=Configuration,DC=dc1,dc=local.
    I can also get the root domain dns of my trusted forest (dc2) from the default naming context under "CN=System" by looking for an object of type "trustedDomain".
    The problem:
    The problem is that I can't see/find the other domains (childs) of the root domain dc2 from the active directory information found in dc1. In order to get these domains I currently bind to this domain controller (dc2) and preform the same search as I did in
    the domain controller dc1 (CN=Partitions,CN=Configuration,DC=dc2,dc=local) to get all its childs.
    Must I use this binding to each root domain in other forest in order to request all of its domains? Is there a better way to do it? I read about referrals which seems like a solution to my problem but I'm not sure if it is and I'm not sure how it should be
    used.
    Note : I'm using the DirectoryEntry class in C#.

    Hello,
    >> read about referrals which seems like a solution to my problem but I'm not sure if it is and I'm not sure how it should be used.
    Here are some information I found on the MSDN which might help you:
    Active Directory Searches Processes and Interactions
    Avoid unnecessary SearchResultReference referral chasing
    In the thread below, there is a code snpont shows the usage of this property:
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/fb338aed-4172-4132-a85e-f9bebdb74e00/when-does-adsi-refferal-chasing-work-?forum=winserverDS
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Sentinel 7 using ldap query to eDirectory

    Hi,
    Is it possible for me to generate a custom report that will perform a
    ldapsearch on my eDirectory to retrieve attributes of users? Or is there
    a way where i can create a collector to connect to my eDirectory
    database?. What I'm planning to do is i would like to customized a
    report to display all users attribute in a report using iReport and
    upload it into Sentinel 7 system, please advise thanks.
    albertngfalls2012
    albertngfalls2012's Profile: https://forums.netiq.com/member.php?userid=4894
    View this thread: https://forums.netiq.com/showthread.php?t=49182

    On 11/13/2013 11:04 AM, albertngfalls2012 wrote:
    >
    > Hi ab,
    >
    > Firstly thanks for your reply, actually i do have an IDM server running
    > currently but how do I export user data to Sentinel using Identity
    > Integration? Correct me if I'm wrong when you say Identity Integration
    > do you mean the driver used for Identity Tracking? If that's the driver
    The Sentinel 7 driver for IDM is for "Identity Tracking", yes, which is
    the feature that feeds data from user objects in the Identity Vault into
    Sentinel, which then means that the data are held in Sentinel for direct
    reporting.
    > that you're mentioning how do I actually pull out all this user data to
    > compile as a report and what tool or language (MySQL, Lucene and etc)
    > should I use? and once I compile this report can I upload it to my
    I'd check the default, built-in reports first to see if there are any that
    report on identities in the system. If so, what you're after may be
    really easy. If not, you could build a report with iReport that queries
    the built-in PostgreSQL database (like other stock reports already can do
    out of the box, so maybe use them as templates if that helps, vs. the
    Lucene ones that will not be as helpful as templates) for the identities.
    I forget the table names now, but I believe they have identity in the
    name... something like usr_identity or similar.
    Good luck.
    If you find this post helpful and are logged into the web interface,
    show your appreciation and click on the star below...

  • ASA WebVPN. How do you restrict access to users in an AD group using LDAP?

    Hi All,
    I am trying to configure separate WebVPN connection profiles to give different portal bookmark contents to users based on their AD group membership.  This has been very difficult, even though I beleive it should be easy.
    The login page of teh ASA by default has a dropdown to allow default users to access the default portal and the SSL VPN client connection.
    There are two other portals that I would like to restrict access to based on AD group membership.  I have set these up to be selected by URL.
    The biggest problem is, I have no way of knowing how to go about this.  The AAA LDAP options show a group membership search, which I have configured, but I cannot say "Profile X is restricted to AD group CarpetBaggers", so that if soneone that is NOT a carpetbagger tries to log in, it fails.
    I can only do an all or nothing scenario.
    It would be nice to use Dynamic Access Policies to do this, and I have created a few, but they do NOT seem to work when the drop down aliases or URLs are in use.  So how do I go about using them in this scenario?  Turning off the aliases or URLs is not really an option right now.
    Scenario 1 would work the best for me.  Restrict access to profiles/groups based on AD group membership using LDAP.
    Scenario 2 would be an ideal longer term solution.
    Any thoughts, ideas or assitance would be greatly appreciated.
    Cheers

    This is exactly what i was looking for, and Nelson is correct.  When you enter the DAP configuration for a profile click on "Advanced" and there is the option to create a logical expression.  The guide (ther is a button to access this) is really helpful, with a couple of examples.  This is what i used:
    assert(function()
       if ( (type(aaa.ldap.distinguishedName) == "string") and
            (string.find(aaa.ldap.distinguishedName, "OU=Users") ~= nil) )
    then
           return true
       end
       return false
    end)()
    from the debug dap you can see what Users relates to;
    DAP_TRACE: Username: MyUsername, aaa.ldap.distinguishedName = CN=Mr B,OU=Users,OU=Site ******,DC=CH,DC=Mycompany,DC=com
    My admin account fails to get me in to the same profile:
    DAP_TRACE: dap_add_to_lua_tree:aaa["ldap"]["distinguishedName"]="CN=Admin Mr B,OU=Admin Users,OU=Site *****,DC=CH,DC=Mycompany,DC=com"
    Thanks
    Andrew

  • To get list of Structure, CKF and RKF where used in query

    Hi All,
    We are going to migrate the queries from BW.3.5 to BI 7.0.
    Our aim  is to get list of Structure, CKF and RKF that are being used in the Info provider along with Queries of these Structure ,RKF's and CKF' s .Is there any way
    to get the where used in query.
    Thanks,
    Mohan

    It's been discussed so many times: Check these forums>>
    http://scn.sap.com/thread/2029042
    BEx metadata tables - how to list Query/Chars/KFs
    Rgds..
    Shambhu

  • 6.1 SP2 Caching realm not caching group members

    Hello:
    We have caching realm set over LDAP security realm.
    We see caching realm never caching group members.
    Any help is appreciated.
    Thanks
    Gennadiy
    Here is the sequence we see:
    1) Search for user name - OK
    2) Search for group name - OK
    3) - ALWAYS going to LDAP to get group members even though they should be cached
    at this point.
    The question is - why does it go to LDAP at all?
    I am doing the same call a 1-2 seconds apart. The group members should be cached.
    It looks like caching realm does not actually cache the members within a group.
    The realm is configured to cache group membership:
    Enable Group Cache true
    Group Cache Size: 211
    Group Cache TTLPositive: 600
    Group Cache TTLNegative: 600
    Group Membership Cache TTL: 300
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <getUser("AppLayerRunAs")>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <user: pos HIT AppLayerRunAs>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <getAcl("weblogic.jndi.CCSAcctEntityBean",
    '.')>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <getAcl("weblogic.jndi.CCSAcctEntityBean")>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <acl: neg HIT weblogic.jndi.CCSAcctEntityBean>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <getAcl("weblogic.jndi")>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <acl: neg HIT weblogic.jndi>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <getAcl("weblogic")>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <acl: neg HIT weblogic>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <getUser("AppLayerRunAs")>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <user: pos HIT AppLayerRunAs>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <getUser("AcctEntityUsers")>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <user: neg HIT AcctEntityUsers>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <getGroup("AcctEntityUsers")>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <group: pos HIT AcctEntityUsers>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <LDAPRealm> <search("ou=ldap, ou=dev_serv,
    ou=hick, o=ccs", "(&(member=cn=AppLayerRunAs,ou=LDAP
    ICK,o=CCS)(objectclass=groupofuniquenames))", base DN & below)>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <getUser("AppLayerRunAs")>
    <Jul 17, 2002 8:53:49 AM EDT> <Debug> <CachingRealm> <user: pos HIT AppLayerRunAs>

    This has been fixed in SP3.
    -utpal

  • Two different results using one query

    Hi Friends
    Oracle version that I am using is : Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    I have a scenario where one account can be related to two customers. Hence, in table have many rows for one account. Here’s the sample data:
    Account_ID | product_code | cust_id | relationship_code | entity_code
    1111 | ABC | 1234 | SOL | CUST
    1111 | ABC | 2222 | ZZZ | LINK
    1111 | ABC | 4455 | ABC | LINK
    2222 | ABC | 7890 | SOL | CUST
    2222 | ABC | 5678 | ZZZ | LINK
    3333 | JFK | 5878 | TST | CUST
    3333 | JFK | 3254 | PRI | CUST
    3333 | JFK | 3299 | PRI | CUST
    4444 | JFK | 2535 | SOL | CUST
    4444 | JFK | 4565 | SOL | CUST
    5555 | DEF | 6666 | PRI | CUST
    5555 | DEF | 6667 | TST | CUST
    5555 | DEF | 9667 | TST | CUSTIn this scenario, I need two outputs differently:
    Output 1: When an account has relationship_code = ‘SOL’ then take the least cust_id
    1111 | ABC | 1234 | SOL | CUST
    2222 | ABC | 5678 | ZZZ | LINK
    4444 | JFK | 2535 | SOL | CUST Output 2: else take the highest cust_id
    3333 | JFK | 5878 | TST | CUST
    5555 | DEF | 9667 | TST | CUSTHow can I get this result using one query?

    Not sure what you mean. Works OK:
    SQL> with t as (
      2             select 1111 account_ID,'ABC' product_code,1234 cust_id,'SOL' relationship_code,'CUST' entity_code from dual union all
      3             select 1111,'ABC',2222,'ZZZ','LINK' from dual union all
      4             select 1111,'ABC',4455,'ABC','LINK' from dual union all
      5             select 2222,'ABC',7890,'SOL','CUST' from dual union all
      6             select 2222,'ABC',5678,'ZZZ','LINK' from dual union all
      7             select 3333,'JFK',5878,'TST','CUST' from dual union all
      8             select 3333,'JFK',3254,'PRI','CUST' from dual union all
      9             select 3333,'JFK',3299,'PRI','CUST' from dual union all
    10             select 4444,'JFK',2535,'SOL','CUST' from dual union all
    11             select 4444,'JFK',4565,'SOL','CUST' from dual union all
    12             select 5555,'DEF',6666,'PRI','CUST' from dual union all
    13             select 5555,'DEF',6667,'TST','CUST' from dual union all
    14             select 5555,'DEF',9667,'TST','CUST' from dual union all
    15             select 6666,'XYZ',8877,'SOL','CUST' from dual
    16            )
    17  select  account_ID,
    18          product_code,
    19          cust_id,
    20          relationship_code,
    21          entity_code
    22    from  (
    23           select  account_ID,
    24                   product_code,
    25                   cust_id,
    26                   relationship_code,
    27                   entity_code,
    28                   case max(case relationship_code when 'SOL' then 1 else 0 end) over(partition by account_ID)
    29                     when 1 then dense_rank() over(partition by account_ID order by cust_id)
    30                     else dense_rank() over(partition by account_ID order by cust_id desc)
    31                   end rnk
    32             from  t
    33          )
    34    where rnk = 1
    35  /
    ACCOUNT_ID PRO    CUST_ID REL ENTI
          1111 ABC       1234 SOL CUST
          2222 ABC       5678 ZZZ LINK
          3333 JFK       5878 TST CUST
          4444 JFK       2535 SOL CUST
          5555 DEF       9667 TST CUST
          6666 XYZ       8877 SOL CUST
    6 rows selected.
    SQL> SY.

  • How to get tasks assigned to me or group in which I belong to using Search Query?

    Hello,
    I want to get the tasks assigned to me or tasks assign to me in which I belong to. I know how to get it using CAML query however I want to get it in my custom search display template using Content Search Web Part.
    <Or>
    <Membership Type="CurrentUserGroups">
    <FieldRef Name="AssignedTo"/>
    </Membership>
    <Eq>
    <FieldRef Name="AssignedTo"/>
    <Value Type="Integer">
    <UserID/>
    </Value>
    </Eq>
    </Or>
    Please let me know how to filter tasks assign to group in which I belong to.
    Here is query which shows tasks assign to me but not to tasks assign to my groups
    (ContentType:Task OR ContentType:RequestTaskContentType OR ContentType:DelegacyAccountingContentType) AND
    AssignedTo:{User.Name} AND
    -Status:Completed AND -Status:Closed AND Status:"Not Applicable"
    Thanks & Regards,
    Jay
    Jayesh Prajapati

    Hi Jay,
    No, you can filter tasks assign to group in which you belong to using Content Search Web Part. Because there is no Query variable for current user group in SharePoint 2013 Search Query. You can have a look at the article:
    https://technet.microsoft.com/en-in/library/jj683123.aspx?f=255&MSPPError=-2147217396
    For a workaround, you can use the My Tasks web part outside of MySites:
    http://bernado-nguyen-hoan.com/2013/03/03/making-my-tasks-web-part-available-outside-of-mysites/
    http://yalla.itgroove.net/2014/04/27/use-sharepoint-tasks-web-part-outside-sites/
    Best Regrads,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group.

    Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
    code I have used:
    //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "";
    Also I have used,
                 String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "ou=ibmgroups,o=ibm.com";
    But in both cases I am getting value for Total groups as 0.
    Code Reference:
    * memberof.java
    * December 2004
    * Sample JNDI application to determine what groups a user belongs to
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    public class memberof     {
         public static void main (String[] args)     {
              Hashtable env = new Hashtable();
              String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
              String adminPassword = "XXXXXXX";
              String ldapURL = "ldap://mydc.antipodes.com:389";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL,ldapURL);
              try {
                   //Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   //Create the search controls          
                   SearchControls searchCtls = new SearchControls();
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
                   //Specify the Base for the search
                   String searchBase = "DC=antipodes,DC=com";
                   //initialize counter to total the group members
                   int totalResults = 0;
                   //Specify the attributes to return
                   String returnedAtts[]={"memberOf"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Search for objects using the filter
                   NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
                   //Loop through the search results
                   while (answer.hasMoreElements()) {
                        SearchResult sr = (SearchResult)answer.next();
                        System.out.println(">>>" + sr.getName());
                        //Print out the groups
                        Attributes attrs = sr.getAttributes();
                        if (attrs != null) {
                             try {
                                  for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
                                       Attribute attr = (Attribute)ae.next();
                                       System.out.println("Attribute: " + attr.getID());
                                       for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
                                            System.out.println(" " +  totalResults + ". " +  e.next());
                             catch (NamingException e)     {
                                  System.err.println("Problem listing membership: " + e);
                   System.out.println("Total groups: " + totalResults);
                   ctx.close();
              catch (NamingException e) {
                   System.err.println("Problem searching directory: " + e);
    Any help will be highly appreciated.

    Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
    code I have used:
    //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "";
    Also I have used,
                 String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "ou=ibmgroups,o=ibm.com";
    But in both cases I am getting value for Total groups as 0.
    Code Reference:
    * memberof.java
    * December 2004
    * Sample JNDI application to determine what groups a user belongs to
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    public class memberof     {
         public static void main (String[] args)     {
              Hashtable env = new Hashtable();
              String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
              String adminPassword = "XXXXXXX";
              String ldapURL = "ldap://mydc.antipodes.com:389";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL,ldapURL);
              try {
                   //Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   //Create the search controls          
                   SearchControls searchCtls = new SearchControls();
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
                   //Specify the Base for the search
                   String searchBase = "DC=antipodes,DC=com";
                   //initialize counter to total the group members
                   int totalResults = 0;
                   //Specify the attributes to return
                   String returnedAtts[]={"memberOf"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Search for objects using the filter
                   NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
                   //Loop through the search results
                   while (answer.hasMoreElements()) {
                        SearchResult sr = (SearchResult)answer.next();
                        System.out.println(">>>" + sr.getName());
                        //Print out the groups
                        Attributes attrs = sr.getAttributes();
                        if (attrs != null) {
                             try {
                                  for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
                                       Attribute attr = (Attribute)ae.next();
                                       System.out.println("Attribute: " + attr.getID());
                                       for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
                                            System.out.println(" " +  totalResults + ". " +  e.next());
                             catch (NamingException e)     {
                                  System.err.println("Problem listing membership: " + e);
                   System.out.println("Total groups: " + totalResults);
                   ctx.close();
              catch (NamingException e) {
                   System.err.println("Problem searching directory: " + e);
    Any help will be highly appreciated.

  • Getting Records Returned When Criteria Doesn't Match (Using One Query)

    I have made two queries which I would like to fold into one query if possible. The first query includes all grp_id's. The second query updates grp_id's with an (active) member count. This second query has criteria in it that grabs only grp_id's that have active members. This would be similar to say, for example, a left join situation where everything is returned from table A and only those matching from table B.
    The problem is that if I put these together, they have to be linked by grp_id, so obvioulsy, if I put these queries together, the only grp_id's I will get back are the ones that have active members in them, but as I mentioned, I need all grp_id's to be shown regardless of any active membership.
    So, here is the code that doesn't work to give a better idea of what I want.
    select g00.grp_id,
    count(m06.subs_ssn)
    from gmaster g00
    join m_elig m06 on
    g00.grp_id = m06.grp_id
    and m06.eff_date < sysdate
    and m06.exp_date > sysdate
    and m06.stat_code = 'ACTIVE'
    group by g00.grp_id
    Again, this will only give me counts for grp_id's with active members in them, whereas I want all grp_id's shown and those grp_id's without active members to have a zero next to the count..
    m06 gives the member data and g00 gives the grp_id data. The m06 eff_date and exp_date and stat_code as shown above determine active members..
    Thanks for any suggestions..

    I don't know why its not working. I did make an error in the intial posting of the data which was to put NOAM in grpid 'C'. I thought this might be my error, but I corrected it and am still getting the same results.
    I have repasted the DDL statements, the query I'm using, the results and also the data as it shows when I query the two tables. (my query is based off the tables created using the posted DDL).
    I also posted QUERY B. Which shows that the removal of the eff_dt and exp_dt criteria allows grp_id to be posted in the results, obviously showing 1 record as I no longer am defining an ACTIVE member by having criteria as posted in QUERY A.
    Is my LEFT OUTER JOIN statement written correctly?
    Also of note: I could not insert the data without the apostrophes in the dates. It gave me an error (Column not allowed here). Using the apostrophes eliminates this message and allows the data insertion. At least for now its not causing an issue as the data shows correct when I query it based a simple query of the dates.
    Using PL/SQL don't know if that makes a difference..?
    =======================================================
    DATA IN TBL: GRP_ID:
    1     A
    2     B
    3     C
    4     D
    DATA IN TBL: MBR
    1     MARK     A     Y     1/1/2011     7/1/2011
    2     MARK     A     Y     7/1/2011     1/1/2012
    3     MARTY     A     Y     1/1/2011     7/1/2011
    4     MARTY     A     Y     7/1/2011     1/1/2012
    5     FRANK     B     Y     1/1/2011     7/1/2011
    6     FRANK     B     Y     7/1/2011     1/1/2012
    7     MARY     B     Y     1/1/2011     7/1/2011
    8     MARY     B     Y     7/1/2011     1/1/2012
    9     JEAN     C     Y     1/1/2011     7/1/2011
    10     JEAN     C     Y     7/1/2011     1/1/2012
    11     NOAM     D     Y     1/1/2011     7/1/2011
    As you can see, Mark, Marty should have 1 active record in grp_id 'A' (total 2), Frank and Mary should have 1 active record each 'B' (total 2), Jean should have 1 active record in 'C' grp_id, total 1) and Noam should have no active records.
    ====================================
    QUERY A:
    SELECT
    g00.grpid,
    count(m00.grpid) mbr_count
    FROM
    grp_id g00
    left outer join mbr m00 on
    g00.grpid = m00.grpid
    WHERE
    m00.eff_dt < sysdate
    AND
    m00.exp_dt > sysdate
    GROUP BY
    g00.grpid
    QUERY A RESULTS
    1     A     2
    2     B     2
    3     C     1
    QUERY B
    SELECT
    g00.grpid,
    count(m00.grpid) mbr_count
    FROM
    grp_id g00
    left outer join mbr m00 on
    g00.grpid = m00.grpid
    GROUP BY
    g00.grpid
    QUERY B RESULTS:
    1     A     4
    2     B     4
    3     C     2
    4     D     1
    =================================================
    DDL STATEMENTS
    create table mbr (mbr_name varchar(10), grpid varchar(1), stat varchar(1), eff_dt date, exp_dt date)
    insert into mbr values ('MARK', 'A','Y', '01-jan-2011', '01-jul-2011')
    insert into mbr values ('MARK', 'A','Y','01-jul-2011', '01-jan-2012')
    insert into mbr values ('MARTY', 'A','Y','01-jan-2011', '01-jul-2011')
    insert into mbr values ('MARTY', 'A','Y', '01-jul-2011', '01-jan-2012')
    insert into mbr values ('FRANK', 'B','Y','01-jan-2011', '01-jul-2011')
    insert into mbr values ('FRANK', 'B','Y','01-jul-2011', '01-jan-2012')
    insert into mbr values ('MARY', 'B','Y','01-jan-2011', '01-jul-2011')
    insert into mbr values ('MARY', 'B','Y','01-jul-2011', '01-jan-2012')
    insert into mbr values ('JEAN', 'C','Y','01-jan-2011', '01-jul-2011')
    insert into mbr values ('JEAN', 'C','Y','01-jul-2011', '01-jan-2012')
    insert into mbr values ('NOAM', 'D','Y','01-jan-2011', '01-jul-2011')
    commit

Maybe you are looking for

  • Error while starting Tomcat Apache and Jaguar services in AW webview server

    hi, I am facing a problem with AW webview server. I am not able to restart the Tomcat Apache and Jaguar Service after a planned server reboot activity.I am getting the below error. "Could not start Apache Tomcat service on Local Computer. Error 1069.

  • Database exceptions data missing in SMD 7.1

    Hello all, I have configured SMD on SolMan 7.1 SP03. I successfully connected 2 systems (ABAP single and JAVA single) to technical monitoring. Also SolMan self-monitoring was configured successfully. I can see some monitoring data in solman_workcente

  • How can one display 1 record at a time

    How can one display a single record at a time. The next record should be displayed on the press of a button. Thanks in advance

  • Just a quection on technology

    Hello, gurus! I'm writing a programm which is setting up network connections on Linux for not advanced users. I mean I have JComboBox with available Network profiles and a button to press for executing network configuration command. The question is:

  • Mail does not recognize my new changed password

    so i had my ipad stolen today and I changed my passwords to both of my email addresses. For some reason mail does not want to sync with my gmail. It says that I have wrong username or password. My iphone doesnt accept it either... But i am able to lo