Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 683
  • Last Modified:

LDAP connection?

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
theo kouwenhoven
Asked:
theo kouwenhoven
  • 3
  • 2
  • 2
  • +2
1 Solution
 
daveslaterCommented:
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
 
HCommented:
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
 
HCommented:
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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
theo kouwenhovenAuthor Commented:
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
 
tliottaCommented:
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
 
theo kouwenhovenAuthor Commented:
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
 
tliottaCommented:
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
 
shalomcCommented:

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
 
theo kouwenhovenAuthor Commented:
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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now