|
[Exercise | API Docs | Short Course| Exercises] Help is available for each task.
Task 1In doUpdate(), add code to get any Connection warnings, using the sqlw variable for the statement;
stmt = con.createStatement();
If warnings were retrieved, invoke handleSQLWarnings() method; Clear the warnings.
Task 2In doUpdate(), in the first catch( SQLException SQLe) block, add code to invoke handleSQLExceptions().
handleSQLExceptions(
SQLe,
"problems connecting to " + sURL + ":",
null );
Task 3In doUpdate(), after the iProcessed = stmt.executeUpdate( sUpdate ) statement, add code to report if no rows were processed by an SQL statement - use iProcessed, otherwise increment a rows processed total - iProcessedCount.
Task 4In doUpdate(), immediately after the previous code, add code to get and handle any Statement warnings, using the sqlw variable.
Task 5In the following catch( SQLException SQLe) block, add code to invoke handleSQLExceptions().
handleSQLExceptions(
SQLe,
"problems with executeUpdate:",
sUpdate );
Task 6Add code to report total rows processed in the finally block.
System.out.println( iProcessedCount +
" rows processed." );
Task 7Add code in handleSQLExceptions() to invoke reportSQLExceptions() for each exception retrieved, using while( SQLe != null ) and SQLe = SQLe.getNextException(). After the first invocation, only SQLe and nulls should be passed to reportSQLExceptions().
Task 8Add code in handleSQLWarnings() to invoke reportSQLExceptions() for each warning retrieved, using while( SQLw != null ) and SQLw = SQLw.getNextWarning(). After the first invocation, only SQLw and nulls should be passed to reportSQLExceptions().
Task 9Insert code in reportSQLExceptions() for complete reporting. If sSQL was not null, get and report the native SQL; If s was not null, report the program-sent text; Get the SQLState and report all available SQLException information; If the SQLState is "01004", report all DataTruncation information.
Copyright 1996-2000 jGuru.com. All Rights Reserved. | |||||||||||||||||||
|
| ||||||||||||