A Simple Database Query Program

Listing 3.1 shows a simple JDBC query program. The database used for this example is the Cloudscape database, a 100% pure Java database available from http://www.cloudscape.com. The program puts together the various concepts you have already seen in this chapter.

Code Listing 3.1. Source Code for SimplyQuery.java
 package usingj2ee.jdbc; import java.sql.*; public class SimpleQuery { public static void main(String[] args) { try { // Make sure the DriverManager knows about the driver Class.forName("COM.cloudscape.core.JDBCDriver"); // Create a connection to the database Connection conn = DriverManager.getConnection( "jdbc:cloudscape:j2eebook"); // Create a statement Statement stmt = conn.createStatement(); // Execute ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.