Newsletters Archive - All

If you would like to know more about the Newsletter, please email me.

  Example JDBC Class for Oracle — (10-May-2009)

I recently created an example JDBC class that provides a convenient template 
which demonstrates some of the more helpful JDBC API calls while using an 
Oracle Database. The methods defined in this class will be used to create a 
test table in the SCOTT schema named JDBC_EXAMPLE. A set of random values will 
then be inserted into the new table and then queried back using basic JDBC 
calls. The random values being used to populate the test table will come from 
the dictionary view ALL_OBJECTS.

This class is useful in demonstrating how to fetch integers, floating-point 
numbers, strings, and dates from a result set and furthermore, how to 
manipulate and print the data from the database. The example class also 
demonstrates how to calculate the run time of queries and DML calls 
(in milliseconds), format dates, and basic exception handling.

The class concludes by dropping the test table and then logging off from the 

This new Java class can be accessed from the "Java Programming Examples" page 
which includes many other example Java classes.

From the left topics menu, select "Programming  -> Java" and then from the 
"Java Programming Examples" page, scroll down to "JDBC -> JDBC Example".

You can also use the following URL to access the new Java class directly:

Jeffrey M. Hunter, OCP
Sr. Database Administrator