Solved

LDAP connection?

Posted on 2006-06-30
9
649 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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
 
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 33

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Employees depend heavily on their PCs, and new threats like ransomware make it even more critical to protect their important data.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

13 Experts available now in Live!

Get 1:1 Help Now