Moving from 31-bit Java routines to 64-bit Java routines

Modify your existing 31-bit Java routine environments to run Java routines in a 64-bit Java virtual machine (JVM). This change can provide better scalability and performance.

About this task

A stored procedure address space in which JVMs use 64-bit addressing supports a multi-threaded JVM model. With this model, the WLM address space starts a single JVM that can concurrently execute multiple Java stored procedures or user-defined functions. This model is more efficient than the 31-bit model, in which a single routine runs in a JVM.

To run Java routines in 64-bit JVMs, you need to make several changes to the environment and to your Java applications.

Procedure

  1. Define a startup procedure for a WLM environment in which 64-bit JVMs can run.

    The following JCL shows an example of such a WLM startup procedure.

    //DSNWJ64 PROC RGN=0K,APPLENV=DSNWLM_JAVA64,DB2SSN=DSN,     1 
    //       NUMTCB=25,MNSPAS=0
    //IEFPROC EXEC PGM=DSNX9WJM,REGION=&RGN,TIME=NOLIMIT,       2 
    // PARM='&DB2SSN,&NUMTCB,&APPLENV,&MNSPAS'  
    
    //STEPLIB DD DISP=SHR,DSN=DSNC10.RUNLIB.LOAD  
    // DD DISP=SHR,DSN=CEE.SCEERUN  
    // DD DISP=SHR,DSN=DSNC10.SDSNEXIT  
    // DD DISP=SHR,DSN=DSNC10.SDSNLOAD  
    // DD DISP=SHR,DSN=DSNC10.SDSNLOD2  
    //JAVAENV DD DISP=SHR,DSN=WLMIJAV.JSPENV                  
    //JSPDEBUG DD SYSOUT=A                                   
    //CEEDUMP DD SYSOUT=A  
    //SYSPRINT DD SYSOUT=A  
    
    Note Explanation
     1  In a 64-bit environment, NUMTCB controls the number of concurrent Java stored procedure executions in a JVM. NUMTCB can be higher for a WLM address space that supports 64-bit JVMs than for one that supports 31-bit JVMs.
     2  Program DSNX9WJM supports 64-bit JVMs.
  2. Alter your stored procedure or user-defined function definitions to specify a WLM environment name that matches the APPLENV value in the previous step.
  3. Define the application environment for 64-bit Java routines to WLM.

    In WLM setup panels, use values like those that are shown in the following screen examples.

      File  Utilities  Notes  Options  Help                                         
    ------------------------------------------------------------------------        
                        Definition Menu     WLM Appl                                
    Command ===> ___________________________________________________________        
                                                                                    
    Definition data set . :  none                                                   
    Definition name  . . . . DSNWLM_JAVA64                                          
    Description . . . . . .  Environment for Java stored procedures                 
    Select one of the                                                               
    following options. . .   9  1. Policies                                         
                                2. Workloads                                        
                                3. Resource Groups                                  
                                4. Service Classes                                  
                                5. Classification Groups                            
                                6. Classification Rules                             
                                7. Report Classes                                   
                                8. Service Coefficients/Options                      
                                9. Application Environments                         
                               10. Scheduling Environments                          
    
    Definition name
    Specify the name of the WLM application environment that you are setting up for 64-bit routines. This is the same application environment name that you specified in the ALTER PROCEDURE or ALTER FUNCTION statement in the previous step.
    Description
    Specify any value.
    Options
    Specify 9 (Application Environments).
      Application-Environment  Notes  Options  Help                           
    ------------------------------------------------------------------------        
                        Create an Application Environment                           
    Command ===> ___________________________________________________________        
                                                                                    
    Application Environment Name . : DSNWLM_JAVA64                                  
    Description  . . . . . . . . . . Environment for 64-bit Java routines           
    Subsystem Type . . . . . . . . . DB2                                            
    Procedure Name . . . . . . . . . DSNWJ64                                        
    Start Parameters . . . . . . . . DB2SSN=DB2T,NUMTCB=25,APPLENV=DSNWLM_JAVA64    
                                     _______________________________________        
                                     ___________________________________            
                                                                                    
    Limit on starting server address spaces for a subsystem instance:               
    1   1.  No limit.                                                               
        2.  Single address space per system.                                        
        3.  Single address spaces per sysplex.                                      
    
    Subsystem Type
    Specify Db2.
    Procedure Name
    Specify a name that matches the name of the JCL startup procedure for the stored procedure address spaces that are associated with this application environment.
    Start Parameters
    If the Db2 subsystem in which the stored procedure runs is not in a sysplex, specify a DB2SSN value that matches the name of that Db2 subsystem. If the same JCL is used for multiple Db2 subsystems, specify DB2SSN=&IWMSSNM. The NUMTCB value depends on the type of stored procedure you are running. For running 64-bit Java routines, the recommended value is 25. Specify an APPLENV value that matches the value that you that you specified in the ALTER PROCEDURE or ALTER FUNCTION statement in the previous step.
    Limit on starting server address spaces for a subsystem instance
    Specify 1 (no limit).
  4. For Java routines that make Java Native Interface calls, recompile and link-edit the DLLs for the native functions in 64-bit mode.
  5. This step is necessary only for a Java routine that is in a JAR file that is installed in the Db2 catalog, when the routine definition specifies a COLLID value that is not NULLID.

    If the Java routine definition specifies a COLLID value that is different from the collection into which the IBM® Data Server Driver for JDBC and SQLJ packages are bound, run the DB2Binder utility with the -collection option to bind the driver packages into the same collection as the Java routine COLLID value. If you do not do so, you might receive SQLCODE -805 when a Java routine executes in a 64-bit environment.