COL3 contains an offset of zero since this is the first row in the file. This is the offset from within the TEST.SBF table in which the binary data resides. Starting at the given offset, the first four bytes will be the length indicator, followed by the actual binary data that was inserted. Note that any character or binary data must be enclosed in single quotation marks. We ll be looking at plenty of code from the SimpleText driver throughout this chapter. But first, let s start by exploring what is provided by the JDBC developer s kit. The DriverManager The JDBC DriverManager is a static class that provides services to connect to JDBC drivers. The DriverManager is provided by JavaSoft and does not require the driver developer to perform any implementation. Its main purpose is to assist in loading and initializing a requested JDBC driver. Other than using the DriverManager to register a JDBC driver (registerDriver) to make itself known and to provide the logging facility (which is covered in detail later), a driver does not interface with the DriverManager. In fact, once a JDBC driver is loaded, the DriverManager drops out of the picture all together, and the application or applet interfaces with the driver directly. JDBC Exception Types JDBC provides special types of exceptions to be used by a driver: SQLException, SQLWarning, and DataTruncation. The SQLException class is the foundation for the other types of JDBC exceptions, and extends java.lang.Exceptn. When created, an SQLException can have three pieces of information: a String describing the error, a String containing the XOPEN SQLstate (as described in the XOPEN SQL specification), and an int containing an additional vendor or database-specific error code. Also note that SQLExceptions can be chained together; that is, multiple SQLExceptions can be thrown for a single operation. The following code shows how an SQLException is thrown: //———————————————————————- —– // fooBar // Demonstrates how to throw an SQLException //———————————————————————- —- public void fooBar() throws SQLException { throw new SQLException(”I just threw a SQLException”); } Here s how you call fooBar and catch the SQLException: try { fooBar(); } catch (SQLException ex) { // If an SQLException is thrown, we’ll end up here. Output the error
Do you want truly affordable web hosting? With us, what you see is what you get, just click on affordable web hosting services.