iSeries

When you need to connect to an IBM iSeries/AS400 database this component will help you. There are two ways of getting a connection; a direct connection or through a pool. For more info about pools see the Connections Pool section of the help.

An iSeries connection is more than just a database connection. It allows you to run commands, programs, list spooled files, and more. See the AS400 category for an overview of what you can do.

Usage

Direct connection

Using a direct connection means that you connect to the database server directly using an IP address and a port. This is the easiest way since there is no configuration needed and it only requires a few parameters. However for production code, we strongly recommend you to look at connection pooling.

A connection is direct when the Connection pool option is not checked.

Basic fields

The first fields are self explanatory, enter the IP address or hostname in the Server field, the port in Port and type in the name of the database you want to use in the Database field. User id and Password are your login credentials.

Library

Enter all libraries you want to include for your connection in this field comma separated, for example:

AS400Connection con1 = new AS400Connection("10.0.0.13", "ABC602AS,ABC602AP,RNT602AP,A600EP,A600AP", "serobkle", "#$E%0xcGFzc3dvcmQ=", "", false, 0);

The A600AP library is the IBS Enterprise release 6.0.0 base library and is usually a minimum when connecting to IBS Enterprise.

Properties

The Properties field allows you to specify any connection properties.

Libraries at end

When you check this option the libraries you supply in the Library field will be added to the end of the library list which means that when objects in different libraries have the same name the object higher up in the library list (i.e. towards the beginning) will get prioritized.

Priority

From IBM's help:

Specifies the run priority for the job. Run priority is a value, ranging from 1 (highest priority) through 99 (lowest priority), that represents the priority at which the job competes for the processing unit relative to other jobs that are active at the same time. This value represents the relative (not the absolute) importance of the job. For example, a job with a run priority of 25 is not twice as important as one with a run priority of 50. This value is the highest run priority allowed for any thread within the job. Individual threads within the job may have a lower priority. Changing the run priority of the job will affect the run priorities of all threads within the job. For example, the job is running at priority 10, thread A within the job is running at priority 10 and thread B within the job is running at priority 15. The priority of the job is changed to 20. The priority of thread A would then be adjusted to 20 and the priority of thread B would be adjusted to 25.

The default value is 0 which tells the iSeries system to automatically determine the priority.

Typipcal direct connection example

AS400Connection con1 = new AS400Connection("10.0.0.13", "", "serobkle", "#$E%0xcGFzc3dvcmQ=", "", false, 0);

Pooled connection

The recommended way to use connections is to use a connection pool. When you have a pool setup you check the Connection Pool option and select your pool from the helper icon. This will give you something like this:

AS400Connection con1 = (AS400Connection) PoolManager.instance().getIPool("myPool").getConnection();

If the list of pooled connection is empty you need to configure your pools in 360's administration tool. Please see the help section for Pool Connections.

Using a login program for IBS Enterprise

You can make a connection to an IBS Enterprise system using an iSeries connection but if you want to do more than to only run queries you will most likely need to run a login program for a given company. Something like this:

AS400Program pgm = AS400Program.execute(con1, "*LIBL", "ACSINLPGM", true, "CHAR(2)", "SE");

Above we have an iSeries/AS400 connection called con1 and we execute the program ACSINLPGM with the company code SE as a parameter.