Appendix E. Special Floating-Point Values

 
[Page 1154 ( continued )]

Programming Exercises

33.1* ( Batch update ) Write a program that inserts a thousand records to a database, and compare the performance with and without batch updates, as shown in Figure 33.7(a). Suppose the table is defined as follows :
   create table   Temp(num1   double   , num2   double   , num3   double   ) 

Figure 33.7. The program demonstrates the performance improvements that result from using batch updates.
(This item is displayed on page 1155 in the print version)

Use the Math.random() method to generate random numbers for each record. Create a dialog box that contains DBConnectionPanel , discussed in Programming Exercise 32.3. Use this dialog box to connect to the database. When you click the Connect to Database button in Figure 33.7(a), the dialog box in Figure 33.7(b) is displayed.


[Page 1155]
33.2** ( Scrollable result set ) Write a program that uses the buttons First , Next , Prior , Last , Insert , Delete , and Update display, and modify a single record in the Address table, as shown in Figure 33.8.
Figure 33.8. You can use the buttons to display and modify a single record in the Address table.


33.3** ( Handling all types of columns ) Rewrite the example in Listings 33.3, 33.4, and 33.5 (TestTableEditor.java, TableEditor.java, and NewRecordDialog.java) to enable it to insert all types of columns (not just strings).
33.4** ( Editing table using RowSet ) Rewrite the example in Listings 33.3, 33.4, and 33.5 (TestTableEditor.java, TableEditor.java, and NewRecordDialog.java) using RowSet .
33.5** ( Storing and retrieving images using RowSet ) Rewrite the example in Listing 33.10 (StoreAndRetrieveImage.java) using RowSet .
33.6* ( Displaying images from database ) Write a program that uses JTable to display the Country table created in Listing 33.10 (StoreAndRetrieveImage.java), as shown in Figure 33.9.
Figure 33.9. The Country table is displayed in a JTable instance.


 


[Page 1156]
 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

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