Solved

LDAP connection?

Posted on 2006-06-30
9
639 Views
Last Modified: 2011-08-18
Hi Experts,

I have to retrieve some information from some server somewhere in the network, I asked the network people here
and they told me they can help me if I can define a LDAP connection... So I told them:

 "Hey... no problem.. it's an AS/400 so of course it is possible"  

I'm almost sure that I am right, but I just have to know how....
please can someone tell me how to define an LDAP connection and how it is globaly working ?

Thanks a lot, and have a nice weekend.

Murph
0
Comment
Question by:theo kouwenhoven
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 14

Expert Comment

by:daveslater
ID: 17017976
Hi
I have not set one up but here is a red book with the details
http://www.redbooks.ibm.com/abstracts/SG246193.html?Open
One of the other guys may have more spacific examples

Dave
0
 
LVL 8

Expert Comment

by:H
ID: 17018892
Lets take a step back...You mentioned you needed to retrieve some information from some non-as/400 server somewhere in the network?  Basically your trying to use the as/400 to get data from a differnt system?  Is this correct?

I can help I just need more detail on what you are trying to do.

So you mentioned setting up directory services on the as/400 .  Im betting they are already setup..

Are you trying to retrive/send a flat/text file or straight data?  
0
 
LVL 8

Expert Comment

by:H
ID: 17019063
Also can you go onto an as/400 command line and take the following steps

Command: QSYS/NETSTAT
take option# 3
Scroll until you find LDAP...Is it in a listening state?
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 17019295
Hi Experts,

I have some more information...
Some server on the net work with some information, is als o replicated to an Oracle DB
maybe it is better to uose that?????  But even then I don't know where to start.

What I want to do:
On this moment, a user is filling a file with an existing program, and copy and paste the info from a web-based application. I planned to create a new program, so that he only have to enter the key and 80% from his info is retrieved from the web based application or from the Oracle server...

Regards,
Murph
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 27

Expert Comment

by:tliotta
ID: 17021019
Murph:

Your network people have claimed that they can provide something that you apparently asked for. They say that they can provide it if you "can define a LDAP connection".

Taking them at their word...

...then what connection are they asking for? Connection to what? from what?

Yes, AS/400s have had both LDAP server and client facilities for a long time. But what does that have to do with what you asked them about? Are they saying that you need to run some LDAP queries against an LDAP server that they have running somewhere in your network, and you need to "define a LDAP connection" in order to do that? If so, I would assume that they mean you need to know how to run LDAP queries. You essentially have to connect to an LDAP server just like you'd have to connect to a remote SQL database. I.e., you have to "define a LDAP connection" with the ldap_open() API.

Or maybe they mean something different entirely.

It _seems_ like you want to do an LDAP query in order to find out if you should retrieve some info from the web app or you should retrieve it from Oracle; the LDAP info would tell your program where to go next.

Is that close?

Tom
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 17021060
Tom,

I really don't know anything about LDAP or remote SQL....
after the weekend, I will ask them to explain me what they can offer me and where I can get it.

I will go for the easy solution, I dont care if it is LDAP or Oracle.....
the number of records I have to read per time is less then 50 so
the speed is not that important.

have a nice weekend.
Murph.
0
 
LVL 27

Expert Comment

by:tliotta
ID: 17021281
Murph:

It looks like hollecar will have good info for you. I stuck my nose in just to help ensure that the thread gets enough background that (1) the expert can answer and (2) it will be a useful thread for someone in the future.

It's always useful to have a clear picture of the issue.

Tom
0
 
LVL 32

Accepted Solution

by:
shalomc earned 50 total points
ID: 17026865

Here is a short ldap tool that I whipped up a couple of years ago, written in rexx (my favorite).
If performance is important to you then don't use it, there are faster rpg/c options.
you may have to tweak the search parameters a bit, not all ldap servers are the same.
go to qshell and type ldapsearch for a command synopsis.


/********* start of REXX program LDAPSEARCH **************/
/* By Shalom Carmel, 2001                                         */  
/*                                                                       */  
                                                                             
parse arg lower  'SERVER(' server  ')'                                        
parse arg lower  'FILTER(' filterq ')'                                        
parse arg lower  'BASE(' baseq   ')'                                          
parse arg lower  'VERBOSE(' verbose ')'                                      
parse arg lower  'OUTPUT(' output  ')'                                        
parse arg lower  'STMF(' stmfq   ')'                                          
                                                                             
arg command_string                                                            
parse source _system _start _srcmbr _srcfile _srclib                          
this_source='/QSYS.LIB/'_srclib'.LIB/'_srcfile'.FILE/'_srcmbr'.MBR'          
                                                                             
/*                                                                       */  
/*                                                                       */  
                                                                           
select                                                                    
  when verbose='*YES'  then vrb= '-v'                                      
  when verbose='*NO'    then vrb=''                                        
  otherwise            vrb=''                                              
end                                                                        
                                                                           
select                                                                    
  when baseq  =''      then base='base "(objectclass=person)"'            
  otherwise            interpret 'base=  '   baseq                        
end                                                                        
                                                                           
   interpret 'filter= '   filterq                                          
   redirect = ' '                                                          
   usrdta = substr(filter,1,10)                                            
                                                                           
select                                                                    
  when output ='*'     then nop                                            
  when output ='*PRINT'     then do                                        
                                   call print400 usrdta                    
                             end                                              
  when output ='*STMF '     then do                                          
                                 interpret 'stmf = '   stmfq                  
                                 redirect=' > ' stmf                          
                             end                                              
  otherwise            nop                                                    
end                                                                          
                                                                             
   ldapquery = 'ldapsearch' vrb '-h' server '-s sub'  filter        redirect  
/* say ldapquery   */                                                        
    'QSH cmd(''' ldapquery ''')'                                              
  if   output ='*PRINT'     then do                                          
   'CHGSPLFA FILE(QSYSPRT) SPLNBR(*LAST) usrdta(&usrdta)'                    
 end                                                                          
exit                                                                          
                                                                             
                                                                             
                                                                             
print400: procedure                                                          
arg usrdta                                                            
    'ovrdbf stdout tofile(qsysprt)'                                    
 return                                                                

/* Error Trapping Routine      */                                      
Error_Trap:                                                            
interpret 'signal ' end_of_op                                          
                                                                       
/********* end of REXX program LDAPSEARCH **************/


/********* start of command  LDAPSEARCH **************/
LDAPSEARCH:     CMD        PROMPT('LDAP Search')                                
                                                                             
             PARM       KWD(FILTER) TYPE(*CHAR) LEN(100) +                  
                          DFT('"CN=Bugs Bunny,OU=NY,O=Acme"') +              
                          MIN(0) CASE(*MIXED) PROMPT('Filter ')              
             PARM       KWD(SERVER) TYPE(*CHAR) LEN(30) +                    
                          DFT(LDSPTV01) MIN(0) CASE(*MIXED) +                
                          PROMPT('Server ')                                  
/*           PARM       KWD(BASE) TYPE(*CHAR) LEN(50) +                      
                          DFT('"(objectclass=person)"') MIN(0) +            
                          CASE(*MIXED) PROMPT('Base   ')    */              
             PARM       KWD(VERBOSE) TYPE(*CHAR) LEN(4) RSTD(*YES) +        
                          DFT(*YES) VALUES(*YES *NO) MIN(0) +                
                          PROMPT('Verbose')                                  
             PARM       KWD(OUTPUT) TYPE(*CHAR) LEN(6) RSTD(*YES) DFT(*) +  
                          VALUES(* *PRINT *STMF) MIN(0) +                    
                          PROMPT('Output type')                              
             PARM       KWD(STMF) TYPE(*PNAME) LEN(120) MIN(0) CASE(*MIXED) +
                          PROMPT('Stream File')                              
             DEP        CTL(&OUTPUT *EQ '*STMF') PARM((STMF)) +    
                          MSGID(CPD0071)                          
                                                                   
/********* end of command  LDAPSEARCH **************/


CRTCMD CMD(LDAPSEARCH)    
       PGM(*REXX)            
       SRCFILE(QCMDSRC)  
       REXSRCFILE(lib/QREXSRC)
       REXSRCMBR(*CMD)        
       REXCMDENV(*COMMAND)    


0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 17042466
Hey shalomc,

Thanks for the example, I did choose the QAD way quick and dirty, and created with help of your example a QShell command
to fill a file.

QSH        CMD(&LDAPQRY)

where &LDAPQRY is

ldapsearch -b O=xxx,DC=xxxx,DC=xxx,DC=COM -h dir.mynet.com  -s sub uid=<varible>  MyNetCn MyNetDomain MyNetUsername MyNetMail
  > /QSYS.LIB/DCSFCYPH.LIB/WEBLDAP.FILE/<variable>.MBR                                                                          

It works fine for this purpose

THANKS
Murph
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this article, I will show you HOW TO: Suppress Configuration Issues and Warnings Alert displayed in Summary status for ESXi 6.5 after enabling SSH or ESXi Shell.
Hyena v12.2 is now available for downloading and is available in English, French, German and Spanish versions.
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now