Developing DB2 Everyplace Java applications

To develop a DB2 Everyplace application using Java, you can use the Java Software Developer's Kit together with the DB2 Everyplace Java Database Connectivity (JDBC) interface for Java.

This topic provides a high-level overview of the tasks required to develop Java applications with DB2 Everyplace.

Restrictions

DB2 Everyplace does not support multitasking on Symbian. In order to access a database from a second thread, the Connection object from the first thread must be closed before the connection can be established in the second thread. The same Connection object cannot be shared between threads.

Prerequisites

A Java application that accesses DB2 Everyplace uses the DB2 Everyplace JDBC driver. Install Java and JDBC on your workstation if you have not already done so.

Procedure

To develop DB2 Everyplace applications using Java:

  1. Import the java.sql package and any other necessary Java classes.
  2. Load the DB2 Everyplace JDBC driver. The class name is com.ibm.db2e.jdbc.DB2eDriver.
  3. Connect to the database using a URL of the form jdbc:subprotocol:subname. The DB2 Everyplace subprotocol is db2e. If the database is in c:\dir1\dir2, use the URL jdbc:db2e:c:/dir1/dir2/. You may also use a relative path for subname.
  4. Create a Statement object.
  5. Access the database (your application logic goes here):
  6. Release database and JDBC resources by closing the ResultSet, Statement, and Connection objects.

Related concepts

Related tasks

Related reference