Connect to Java with DB2

To use JDBC DB2 in your Java application, you must first download and install a DB2 JDBC driver: db2jcc.jar
http://www.aquafold.com/ 

Once downloaded, you must import the driver into Eclipse: put the driver's folder in your CLASSPATH variable or add the jar file to your project (Properties->Java Build Paths)
To import db2jcc.jar, click on the Window menu in Eclipse and select Preferences. In the resulting dialog box, choose Java then Buid Path then User Libraries. Click on New and define a library name, e.g., DB2LIBS. Then click Add JARs, navigate to the folder that contains db2jcc.jar and add the driver to the library.
Also add db2jcc.jar to tomcat's lib folder to enable the servlet to access the database.

To run your Web application, you would need to install Tomcat on your machine. 
http://tomcat.apache.org 
The easiest way to debug and run your application is to install the Eclipse Tomcat plugin:
http://marketplace.eclipse.org/content/mongrel 

Other DB2 links:

Stony Brook DB2 server: Click here

DB2 Express Server (needed if you want to set up a database on your own machine): 
https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=swg-db2expressc 

DB2 Client (you need it to connect to DB2 remotely): https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?lang=en_US&source=swg-idsrc11 

Data studio: http://ibm.com/db2/express/download.html - Look under "Get free tools.“ 

Using Data Studio: http://publib.boulder.ibm.com/infocenter/idm/v2r2/index.jsp?topic=/com.ibm.datatools.ds.nav.doc/topics/cprodover_ds.html 

DB2 University Training courses: http://www.db2university.com/courses 

DB2 9r7 Database Reference: http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp Click on Database Reference in the left frame, then SQL, then Statements. For user-defined data types (UDTs), see CREATE TYPE (both row and structured). 

DB2 Application Developer's Guide. Version 7: http://www.database-books.us/db2_0002.php - see Chapter 12 and 21.

The Developer Handbook: http://www.redbooks.ibm.com/redbooks/pdfs/sg247301.pdf Chapter 2 (XML) and Chapter 5 (Java+XML)

Extremely pureXML in DB2 10 for z/OS: http://www.redbooks.ibm.com/redbooks/pdfs/sg247915.pdf - Chapters 4, 5, 6.5(user-defined functions), 7.

Getting started with DB2 Express: http://public.dhe.ibm.com/software/dw/db2/express-c/wiki/Getting_Started_with_DB2_Express_v9.7_p4.pdf Chapter 15 for XQuery

More examples of using XQuery and JDBC: 
http://www.ibm.com/developerworks/data/library/techarticle/dm-0605saracco 
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.sql.doc/doc/c0024467.htm