IBM i optimization

There exists two versions of the IBM® Toolbox for Java™ software, one that is optimized when running on the IBM i JVM, and another that runs the same way no matter where the IBM Toolbox for Java is run.

Sign-on behavior and performance are improved when using the optimized version of the IBM Toolbox for Java software and running on the IBM i JVM and connecting to the same server.

Enabling the optimizations

Start of changeIBM Toolbox for Java is shipped as part of Licensed Program 5770-SS1 (option 3) in two directories:
  • The /QIBM/ProdData/http/public/jt400/lib contains the version of the IBM Toolbox for Java that does not include IBM i optimizations. Use these files if you want behavior consistent with running the IBM Toolbox for Java on a client.
  • The /QIBM/ProdData/OS400/jt400/lib contains the version of the IBM Toolbox for Java that does include IBM i optimizations when running on the IBM i JVM.
Note: As of IBM i 7.1, directory /QIBM/ProdData/http/public/jt400 is actually a symbolic link to /QIBM/ProdData/OS400/jt400. The /QIBM/ProdData/http/public/jt400 link is retained in order to maintain compatibility with earlier versions of IBM i.
End of change

For more information see Note 1 in the information about JAR files.

Sign-on considerations

The version of the IBM Toolbox for Java that contains optimizations adds additional options for providing server (system) name, user ID and password information to the IBM Toolbox for Java.

When accessing an IBM i resource, the IBM Toolbox for Java classes must have a system name, user ID and password.

With the IBM Toolbox for Java that contains optimizations, the user ID and password of the current job also can be used when a Java program that is running on one IBM i server accesses the resources on another IBM i server. In this case, the Java program sets the system name, then uses the special value "*current" for the user ID and password.

The Java program can only set the password to "*current" if you are using record-level access V4R4 or later. Otherwise, when you use record-level access, "localhost" is valid for system name and "*current" is valid for user ID; however, the Java program must supply the password.

A Java program sets system name, user ID, and password values in the AS400 object.

To use the user ID and password of the job, the Java program can use "*current" as user ID and password, or it can use the constructor that does not have user ID and password parameters.

To use the current server, the Java program can use "localhost" as the system name or use the default constructor. That is,

     AS400 system = new AS400();

is the same as

     AS400 system = new AS400("localhost", "*current", "*current");

Examples

The following examples show how to sign on to a server by using optimized classes.

Example: Signing on when using different AS400 constructors

Two AS400 objects are created in the following example. The two objects have the same behavior: they both run a command to the current server using the user ID and password of the job. One object uses the special value for the user ID and password, while the other uses the default constructor and does not set user ID or password.

     // Create an AS400 object. Since the default
     // constructor is used and system, user ID and
     // password are never set, the AS400 object sends
     // requests to the local server using the job's
     // user ID and password. If this program were run
     // on a client, the user would be prompted for
     // system, user ID and password.
     AS400 sys1 = new AS400();

     // Create an AS400 object. This object sends
     // requests to the local system using the job's
     // user ID and password. This object will not work on a client.
     AS400 sys2 = new AS400("localhost", "*current", "*current");

     // Create two command call objects that use the AS400 objects.
     CommandCall cmd1 = new CommandCall(sys1,"myCommand1");
     CommandCall cmd2 = new CommandCall(sys2,"myCommand2");

     // Run the commands.
     cmd1.run();
     cmd2.run();

Example: Signing on by using the user ID and password of the current job

In the following example an AS400 object is created that represents a second IBM i server. Since "*current" is used, the job's user ID and password from the server running the Java program are used on the second (target) server.

     // Create an AS400 object. This object sends
     // requests to a second system using the user ID
     // and password from the job on the current server.
     AS400 sys = new AS400("mySystem.myCompany.com", "*current", "*current");

     // Create a command call object to run a command
     // on the target server.
     CommandCall cmd = new CommandCall(sys,"myCommand1");


     // Run the command.
     cmd.run();