24.7. Summary

In this chapter you've been introduced to JDBC programming and seen it in action. The important points covered in this chapter include the following:

  • The fundamental classes in JDBC are as follows:

    • DriverManager manages the loading of JDBC drivers and connections to client applications.

    • Connection provides a connection to a specific data source.

    • Statement provides a context for executing SQL statements.

    • ResultSet provides a means for accessing data returned from an executed Statement.

  • The essential JDBC program has the following basic sequence when writing:

    • Import the necessary classes.

    • Load the JDBC driver.

    • Identify the data source.

    • Allocate a Connection object.

    • Allocate a Statement object.

    • Execute a query using the Statement object.

    • Retrieve data from the returned ResultSet object.

    • Close the ResultSet.

    • Close the Statement object.

    • Close the Connection object.

  • The JTable component provides an easy and convenient way to display the results of database queries.

  • A table model can provide the data to be displayed by a JTable component. A table model is an object of a class that implements the TableModel interface.

Get Ivor Horton's Beginning Java™ 2, JDK™ 5th 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.