Using JDBC to Create Database Objects
By James W. Cooper2003-05-24
Getting Data out of Databases
Suppose we wanted to produce a table of employees and their salary ranges for some planning exercise. This table doesn't exist directly in the database, but it can be constructed by issuing a query to the database. We'd like to have a table that looked like the following:
| Name | Min | Max |
| Adams | $45,000.00 | $60,000.00 |
| Johnson | $30,000.00 | $45,000.00 |
| Smyth | $60,000.00 | $75,000.00 |
| Tully | $30,000.00 | $45,000.00 |
| Wolff | $45,000.00 | $60,000.00 |
or maybe sorted by increasing salary as
| Name | Min | Max |
| Tully | $30,000.00 | $45,000.00 |
| Johnson | $30,000.00 | $45,000.00 |
| Wolff | $45,000.00 | $60,000.00 |
| Adams | $45,000.00 | $60,000.00 |
| Smyth | $60,000.00 | $75,000.00 |
|
Tutorial Pages:
» What is a Database?
» Getting Data out of Databases
» Kinds of Databases
» ODBC
» What Is JDBC?
» Installing and Using JDBC
» Types of JDBC Drivers
» Two-Tier and Three-Tier Models
» Writing JDBC Code to Access Databases
» Registering Your Database with ODBC
» Connecting to a Database
» Accessing the Database
» The ResultSet
» ResultSetMetaData
» DatabaseMetaData
» Getting Information on Tables
» Executing SQL Queries, Printing out ResultSets, A Simple JDBC Program
» Building Higher Level JDBC Objects
» Building a Database Object, A Visual Database Program
» Executing a Query
» The Query Result Dialog
» Example Files
» Summary
First published by IBM DeveloperWorks
