This tutorial demonstrates how to connect to a database using JDBC. While seemingly innocuous, this subject is actually a stumbling block for both newcomers and veterans alike. This tutorial will discuss how a Java application inside a JVM discovers and communicates with a database, starting with the traditional JDBC driver and
DriverManager objects. After several examples that demonstrate the four different types of JDBC drivers, the tutorial moves on to discuss
DataSource objects that use JNDI. A discussion of JNDI, and how to bind, use, rebind, and delete the
DataSource object is also included. Finally, the concept of a connection pool, and specifically
PooledConnection objects are introduced and demonstrated. The tutorial concludes with a discussion of tuning issues that are often overlooked when developing database connectivity applications.