Tuesday, December 11th, 2007
} } As you can see, implementing interfaces is easy. We ll go into more detail with the major JDBC interfaces later in this chapter. But first, we need to cover some basic foundations that should be a part of every good JDBC driver. Tracing One detail that is often overlooked by software developers is providing a facility to enable debugging. The JDBC API does provide methods to enable and disable tracing, but it is ultimately up to the driver developer to provide tracing information in the driver. It becomes even more critical to provide a detailed level of tracing when you consider the possible wide-spread distribution of your driver. People from all over the world may be using your software, and they will expect a certain level of support if problems arise. For this reason, I consider it a must to trace all of the JDBC API method calls (so that a problem can be re-created using the output from a trace). Turning On Tracing The DriverManager provides a method to set the tracing PrintStream to be used for all of the drivers; not only those that are currently active, but any drivers that are subsequently loaded. Note that if two applications are using JDBC, and both have turned tracing on, the PrintStream that is set last will be shared by both applications. The following code snippet shows how to turn tracing on, sending any trace messages to a local file: try { // Create a new OuputStream using a file. This may fail if the // calling application/applet does not have the proper security // to write to a local disk. java.io.OutputStream outFile = new java.io.FileOutputStream(”jdbc.out”); // Create a PrintStream object using our newly created OuputStream // object. The second parameter indicates to flush all output with // each write. This ensures that all trace information gets written // into the file. java.io.PrintStream outStream = new java.io.PrintStream(outFile, true); // Enable the JDBC tracing, using the PrintStream DriverManager.setLogStream(outStream); } catch (Exception ex) { // Something failed during enabling JDBC tracing. Notify the // application that tracing is not available. . . . }
Sbc yahoo internet provider is a name that we will not do any shame to. We are as good in what we do. Our sbc yahoo web hosting team will work hard to meet and satisfy all your web hosting needs.Try us out!