Java Database Support

Many e-commerce and enterprise computing systems are based on access to one or more database systems. Access may involve data supplied to a client dynamically and on demand through the WWW, or it may involve support for the organization's own internal operations through client programs, again supplied through the WWW, that support data entry and update as well as access.

Java provides a very flexible set of tools for accessing DBMS through an API. The core classes in the API are included in the java.sql package and are distributed as part of the standard JDK. Sun offers its own JDBC Database Access tutorial, several advanced JDBC tutorials, and it provides pointers to several tutorials offered by third parties. One such tutorial is offered by JGuru.com. Several tutorials prepared by students in earlier sections of this course are listed below.

Three different architectures will be discussed. The first is a simple "two-tier" system in which an applet communicates with a servlet which, in turn, communicates with a database running on the servlet machine. It uses the simplest of the drivers, the JDBC-ODBC bridge. The second uses a type 3 driver and is a three-tier architecture in which the driver runs as a server on the WWW server machine and connects to a DBMS running on a different machine. The third architecture will illustrate VisualCafe's support for generating database applications in which applet variables are bound directly to table entries. See the attached for a discussion of the four types of JDBC drivers.

The discussions assume that you have already created an Access database. For a tutorial on Access, see Dilip Barman's Introduction to Relational Databases and MS Access. The discussion also assumes that you know basic SQL. For an introduction to SQL, see internet.com's SQL Interpreter and Tutorial. For an introduction to database design based on entity-relationship diagrams, see Tim Hutchin's tutorial on the subject.  Tore Bostrup's tutorial, Introduction to Relational Databases - Part 1: Theoretical Foundation, discusses some of the theoretical under-pinings of relational databases, including the infamous normal forms.


Introduction to Relational Databases and MS Access

Provided by Dilip Barman

Basic Architecture

Basic connections between Servlet components and database.

MySQL Basics

Quick start commands to logon to MySql, create a table, insert records, and see results.

Introduction to JDBC

Provided by Rich Thornett

Basic Java - JDBC Constructs

Reviews Java language constructs for basic interaction with a DBMS and for processing ResultSets.

Example: Servlet using MySQL

Hello, World- level servlet similar to the one discussed in Example 1, but adapted to use a MySQL driver to connect to a MySQL database running on a remote machine or on the same machine.

Handling Images

Discussion of architecture and implementation issues for uploading images and other file data from an HTML form, storing that information in the server's file system, and registering associated information in a DBMS.