|
[Help | API Docs | Short Course| Exercises] The basics of loading a JDBC driver, connecting to the database, creating a Statement, doing the actual work of the program, then closing the Statement and Connection are fundamental to virtually every JDBC program. This initial exercise is really meant to serve as an example and you are not expected to provide any code. Instead, you should pull up the suggested solution source and the help section, where the important areas of the Create4JData application, which creates and populates the JJJJData table, are explained in some detail. Note that the program, as it stands, will only run properly against a Cloudscape database because the driver and connection information are hardcoded with literals. You can change this information and recompile to run against other databases. Later in the course, methods will be introduced to obtain this information in ways that do not require changing the program. PrerequisitesNone Tasks
Load the JDBC driver class. Get a Connection and create a Statement, using jdbc:cloudscape:rmi:jGuru;create=true as the DatabaseURL for Cloudscape. If a previous copy of JJJJData exists, remove it from the database. Create the JJJJData table and insert the data. Where help exists, the task numbers above are linked to the step-by-step help page. Solution SourceDemonstrationWhen this program has been compiled and run against the database, the JJJJData table, as discussed in A Complete Example, will be created and populated with the data shown in that section. Copyright 1996-2000 jGuru.com. All Rights Reserved. | ||||
|
| ||||||||||||