Call a stored procedure on a SQL Server from my RPGLE source using JDBCR4 service program.

Tags:
iSeries
RPGLE
SQL Server
Stored Procedures
Something is going wrong while setting up the connection environment (ZBCCNNPF). Can someone explain me which parameters have to be set in which way to make this process work? Kind regards, Ton Konings.


Software/Hardware used:
ISeries - SQL-Server
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    Can you post what you have tried so we can take a look?
    Other wise we would be guessing.
    133,595 pointsBadges:
    report
  • TonKonings1962

    Hi Todd,

    The process is started with a CL

    PGM                                                   
                                                          
    ADDENVVAR  ENVVAR(CLASSPATH) +                        
                 VALUE('/jdbc/sqljdbc.jar:.') REPLACE(*YES)
                                                                                                       
    CALL       PGM(ZBC204)                                
                                                          
    ENDPGM                                                
    ***** End of data *************************************

     

    The SQLRPGLE is as follows

    H DFTACTGRP(*NO) BNDDIR('JDBC')                             
     *====================================================      
     * Description of Files                                     
     *====================================================      
    Fzprocl1   if   e           k disk                          
    Fzbccnnl2  if   e           k disk                                 
                                                                       
     /copy jdbc_h                                                      
     *                                                                 
    D qcmdexc         PR                  Extpgm('QCMDEXC')            
    D                             3000a   const options(*varsize)      
    D                               15  5 const                        
    D                                3a   const options(*nopass)       
     *                                                                 
    D conn            s                   like(Connection)             
    D Record          s           1024A                                
    D ErrMsg          s             50A                                
    D rs              s                   like(ResultSet)              
     *                                                                 
    dprgsds          sds                                               
    d User                  254    263                                 
    DTimeStamp        S               Z                                
                                                                      
    c     Ky_zprocl1    klist                                         
    c                   kfld                    prcprg                
    c                   kfld                    prcust                
     *                                                                
    c     Ky_zbccnnl2   klist                                         
    c                   kfld                    bccprg                
    c                   kfld                    bcenv                 
     *                                                                
    C                   Time                    TimeStamp             
    c                   eval      prcprg='*KYO-SQL2'                  
    c                   eval      prcust=*blanks                      
    c     Ky_zprocl1    chain     zprocr                              
    c                   if        %found(zprocl1)                     
    c                   eval      bccprg=prcprg                       
    c                   eval      bcenv=prenvi                        
    c     Ky_zbccnnl2   chain     zbccnnr                             
    c                   endif                                           
     *                                                                  
     /free                                                              
                                                                        
        conn = MSSQL_Connect(%trim(bchost)+':'+%trim(%char(bcport))     
                           : %trim(bcrpth)                              
                           : %trim(bcuser)                              
                           : %trim(bcpass) );                           
        if (conn = *NULL);                                              
            return;                                                     
        endif;                                                          
                                                                        
      // Execute Stored Procedure                                       
     /end-free                                                          
    C/EXEC SQL                                                          
    C+ Call sp_IMPORT_CUSTOMER                                          
    C/END-EXEC                                                          
                                                                    
     /free                                                          
                                                                    
        jdbc_freeResult(rs);                                        
                                                                    
        jdbc_close(conn);                                           
        eval *inlr = *on;                                           
        return;                                                     
     /end-free                                                      
                                                                    
    ****************** End of data **********************************

    The stored procedure is on the SQL server. When running the message 'virtual machine is starting'  appears, and also 'connecting to database'. The Job ends and in the Joblog we see:SP_IMPORT_CUSTOMER in *LIBL type *N not found.

    Do you have any idea what is going wrong?

    Kind regards,

    Ton

    15 pointsBadges:
    report
  • danieljones
    check out this link maybe it will help you out: http://itdoc.hitachi.co.jp/manuals/3020/30203Y0210e/EY020075.HTM  
    2,840 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: