IBM Books

Road Map to DB2 Programming


Using Java



* Figure crosref not displayed.



SQL Getting Started Introduces SQL concepts, and provides examples for many constructs and tasks.
SQL Reference Describes SQL syntax, semantics, and the rules of the language.
Embedded SQL Programming Guide Explains how to develop applications that access DB2 databases using embedded SQL.
Building Applications for Windows and OS/2 Environments Provides environment setup information and step-by-step instructions to compile, link, and run DB2 applications on a Windows or OS/2 system.
Building Applications for UNIX Environments Provides environment setup information and step-by-step instructions to compile, link, and run DB2 applications on a UNIX system.




* Figure webpages not displayed.



http://www.software.ibm.com/data/ db2/java/ Provides information about the Java Database Connectivity (JDBC) API.


There might be cases where you need an application that can access DB2 databases across the Internet. Using the Java programming language, you can develop applications and applets that access and manipulate data in DB2 databases.

DB2 makes this possible by providing support for the Sun Microsystem's Java Database Connectivity (JDBC) API. DB2 provides this support through a DB2 JDBC driver that comes with DB2. The JDBC API, which is similar to ODBC APIs, provides a standard way to access databases from Java code. Your Java code passes SQL statements as function arguments to the DB2 JDBC driver. The driver handles the JDBC API calls from your client Java code.

Java's portability enables you to deliver DB2 access to clients on multiple platforms, requiring only a Java-enabled Web browser.

You can also use the Java programming language to develop user-defined functions and stored procedures which run on the server. These topics are discussed in "User-defined Functions" and "Stored Procedures".

Java Applications

Java applications rely on the DB2 Client Application Enabler to connect to DB2. You start your application from the desktop or command line, like any other application. The DB2 JDBC driver handles the JDBC API calls from your application, and uses the Client Application Enabler to communicate the requests to the server and to receive the results.

Figure 7. Java applications


* Figure sqlu0jap not displayed.

Java Applets

Java applets do not require the DB2 Client Application Enabler on the client. Typically, you would imbed the applet in a HyperText Markup Language (HTML) page.

To run your applet, you need only a Java-enabled Web browser on the client machine. When you load your HTML page, the browser downloads the Java applet to your machine, which then downloads the Java class files and DB2's JDBC driver. When your applet calls the JDBC API to connect to DB2, the JDBC driver establishes a separate network connection with the DB2 database through the JDBC applet server residing on the Web server.

Figure 8. Java applets


* Figure sqlu0jat not displayed.

Java UDFs and Stored Procedures

You can also develop user-defined functions (UDFs) and stored procedures in the Java language. This process is similar to creating UDFs and stored procedures in any other programming language. Once you create and register your Java UDFs and stored procedures, you can call them from applications coded in any supported programming language. These topics are discussed in "User-defined Functions" and "Stored Procedures".


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]