Summary

In this chapter, you discovered the essential steps for communicating with a database:

  • Import java.sql.* to avoid long member names.

  • Build a JDBC URL.

  • Load one or more specific JDBC drivers with class.forName().

  • If necessary, adjust the connection properties.

  • Open a connection with getConnection().

  • Create a statement object.

  • Build a SQL statement.

  • Execute the SQL statement.

  • Manage multiple result sets.

  • Fetch rows of data in cases of a result set of rows.

  • Fetch columns of rows by column name or column index.

  • Fetch integer results.

  • Check for warnings.

  • Manage data truncation errors.

  • Close the result set.

  • Close the statement.

  • Terminate the connection with close().

  • Catch exceptions.

The next chapter discusses data type conversions, how to use the SQL escape syntax, what a database transaction is, and in which context programmers use transactions and also provides examples of using SQL cursors.



JDBC 3. 0. JAVA Database Connectivity
JDBC 3: Java Database Connectivity
ISBN: 0764548751
EAN: 2147483647
Year: 2002
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net