Altova StyleVision 2024 Enterprise Edition

This example illustrates how to connect to an IBM DB2 database server through JDBC.

Prerequisites:

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. StyleVision 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; b) The JVM path found in the Windows registry; c) The JAVA_HOME environment variable.

Make sure that the platform of StyleVision (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 StyleVision.

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 JDBC driver available after installing the IBM Data Server Client version 10.1 (64-bit). For the JDBC drivers to be installed, choose a Typical installation, or select this option explicitly on the installation wizard.

dbc_ibm_db2_jdbc_1

If you did not change the default installation path, the required .jar files will be in the C:\Program Files\IBM\SQLLIB\java directory after installation.

You need the following database connection details: host, port, database name, username, and password.

To connect to IBM DB2 through JDBC:

1.Start the database connection wizard.

2.Click JDBC Connections.

3.Next to "Classpaths", enter the path to the .jar file which provides connectivity to the database. This examples refers to C:\Program Files\IBM\SQLLIB\java\db2jcc.jar. You may need to refer to the db2jcc4.jar driver, depending on the database server version. For driver compatibility, refer to IBM documentation (http://www-01.ibm.com/support/docview.wss?uid=swg21363866). 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.db2.jcc.DB2Driver. 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).

dbc_ibm_db2_jdbc_2

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 the connection details with the ones applicable to your database server.

jdbc:db2://hostName:port/databaseName

7.Click Connect.

© 2017-2023 Altova GmbH