Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

Using MetaData

 

Training Index


[Table of Contents]

Prerequisites

Skeleton Code

The administration at MageLang University maintains a database of information about the course activities of the university's professors. This exercise results in an application that examines the different information kept for the university's instructors through the use of the ResultSetMetaData interface.

This exercise uses the instructors table in the database.

Perform the following tasks:

  1. Copy odbc.datasource file from the previous exercise.

  2. Load the driver and connect to database.

  3. Create a Statement to perform a query.

  4. Execute the "select * from instructors" query.

  5. Get the metadata for the ResultSet.

  6. Examine the metadata to find out the number and datatype of columns, number of nullable columns, and number of numeric columns. You can discover more if you want to.

  7. Print the results.

  8. Close the statement.

  9. Close the connection.

The task numbers above are linked to the step-by-step help page. Also available is a complete solution, which meets these requirements, and Expected Behavior.

Copyright © 1996 Magelang Institute. All Rights Reserved.