DB2® Everyplace® provides a Java™ API that you can use to develop applications
that use the DB2 Everyplace database.
Prerequisite: Install Java and
JDBC on your workstation.
To develop DB2 Everyplace Java applications:
- Import the java.sql package and any
other necessary Java classes.
- Connect to the database either using the DriverManager
class or the DataSource interface. See the sample Java application for details. The
JDBC URL syntax is jdbc:subprotocol:subname. The DB2 Everyplace subprotocol
is db2e.
Restriction: 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.
- Create a Statement object.
- Access the database (your application logic goes here):
- Execute a SQL statement using the Statement object.
- Retrieve data from the returned ResultSet object (if
the SQL statement you executed is a query).
- Release database and JDBC resources by closing the ResultSet,
Statement, and Connection objects.