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.
Install Java and JDBC on your workstation if you
have not already done so, because a Java application that accesses DB2 Everyplace uses
the DB2 Everyplace JDBC
driver.
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.
- 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.