Java Reference
In-Depth Information
The utility program must be executed before using the database for the first
time. It also may be executed to reinitialize the database to its beginning state.
Each time the program runs, it deletes and rebuilds all tables in the database and
establishes the original record as the only data contents.
The following steps open a new Java program source file.
To Open a New Java Program in TextPad
1. With the Data Disk in drive A, click the New Document button on the
Standard toolbar.
2. Click File on the menu bar and then click Save As on the File menu.
When the Save As dialog box is displayed, click the Save in box arrow
and then click 3 1 2 Floppy (A:) in the Save in list.
3. Double-click the Chapter11 folder or the location specified by your
instructor.
4. Type MakeDB in the File name text box. Click the Save as type box arrow
and then click Java (*.java) in the Save as type list. Click the Save button
in the Save As dialog box.
5. Enter lines 1 through 15 as shown in Figure 11-17 on page 709. In the
comments, insert your own name as programmer and enter the current
date.
TextPad displays the code for the initial comments, import statements, class
header, and main() method header (Figure 11-18). The import statement
for the java.sql package provides the framework for installing database driv-
ers as well as accessing and processing data in a database. The main()
method uses the throws Exception clause to claim any uncaught exceptions.
java.sql package
imported
throws
Exception
FIGURE 11-18
 
Search WWH ::




Custom Search