This example illustrates how to connect to an IBM DB2 for i database server through JDBC.
•JRE (Java Runtime Environment) or Java Development Kit (JDK) must be installed. This may be either Oracle JDK or an open source build such as Oracle OpenJDK. UModel will determine the path to the Java Virtual Machine (JVM) from the following locations, in this order: a) The custom JVM path you may have set in application Options, see Java Settings; b) The JVM path found in the Windows registry; c) The JAVA_HOME environment variable.
•Make sure that the platform of UModel (32-bit, 64-bit) matches that of the JRE/JDK. This example uses Oracle's OpenJDK 11.0 64-bit, and, consequently, the 64-bit version of UModel.
•The JDBC driver (one or several .jar files that provide connectivity to the database) must be available on your operating system. This example uses the open source Toolbox for Java/JTOpen version 9.8 (http://jt400.sourceforge.net/). After you download the package and unpack to a local directory, the required .jar files will be available in the lib subdirectory.
•You need the following database connection details: host, username, and password.
To connect to IBM DB2 for i through JDBC:
2.Click JDBC Connections.
3.Next to "Classpaths", enter the path to the .jar file which provides connectivity to the database. In this example, the required .jar file is at the following path: C:\jdbc\jtopen_9_8\jt400.jar. Note that you can leave the "Classpaths" text box empty if you have added the .jar file path(s) to the CLASSPATH environment variable of the operating system (see also Configuring the CLASSPATH).
4.In the "Driver" box, select com.ibm.as400.access.AS400JDBCDriver. This entry becomes available only if a valid .jar file path was found either in the "Classpaths" text box, or in the operating system's CLASSPATH environment variable (see the previous step).
5.Enter the username and password of the database user in the corresponding text boxes.
6.Enter the JDBC connection string in the Database URL text box. Make sure to replace host with the host name or IP address of your database server.