As illustrated in the previous exercises, the database has a music store theme. This exercise sets up the database with one table for music CDs. This exercise includes a pre-built database for the Cloudscape database system in JAR format. Also, the skeleton code and solutions sections include programs for building the database via JDBC. Note that all utility programs associated with this project have "-usage", "-help", and "-h" command-line options. PrerequisitesResources
Tasks
Choose a database system appropriate for your environment and then either install or build the database system with the music data that you prefer.
Verify the integrity of the database using a vendor-supplied graphical tool or the DatabaseTool.java program provided. Where help exists, the task numbers above are linked to the step-by-step help page. Solution Source
There is no explicit solution to this exercise. If you have set up the database correctly, then when you run cloudscape -start you will see output similar to the following: myhost> cloudscape -start Wed Jan 12 11:51:20 PST 2000: [RmiJdbc] COM.cloudscape.core.JDBCDriver registered in DriverManager Wed Jan 12 11:51:20 PST 2000: [RmiJdbc] Binding RmiJdbcServer... Wed Jan 12 11:51:20 PST 2000: [RmiJdbc] No installation of RMI Security Manager... Wed Jan 12 11:51:22 PST 2000: [RmiJdbc] RmiJdbcServer bound in rmi registry Likewise, when you startup J2EE RI you should see something like the following: myhost> j2ee -verbose Naming service started: :1050 Published the configuration object ... Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true Binding DataSource, name = jdbc/MusicStore, url = jdbc:cloudscape:rmi:MusicStoreDB;create=false Configuring web service using "default" Web service started: :9191 Web service started: :7000 Configuring web service using "default" Configuring web service using "file:/D:/j2sdkee1.2/public_html/WEB-INF/web.xml" Web service started: :8000 Endpoint [SSL: ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=7000]] shutdown due to exception: javax.net.ssl.SSLException: No available certificate corresponds to the SSL cipher suites which are enabled. endpoint down: :7000 J2EE server startup complete. Demonstration
The expected behavior is database-specific. Most database systems provide some type of graphical viewing tool, so you should be able to verify the integrity of your database by browsing its tables. For example, Cloudscape provides a program called Cloudview. Cloudview may be run by executing the command: myhost> java -Dcloudscape.system.home=%J2EE_HOME%\cloudscape \ -classpath %J2EE_HOME%\lib\cloudscape\tools.jar; %J2EE_HOME%\lib\cloudscape\cloudscape.jar; %J2EE_HOME%\lib\cloudscape\license.jar;%CLASSPATH% \ -ms16m -mx32m COM.cloudscape.tools.cview(type the above all on the same line, with the classpath all together). The MusicCD table, when viewed in Cloudview, looks something like this: If you don't have a vendor-supplied graphical tool, compile DatabaseTool.java which is provided as one of the resources for this exercise, and use it to build, manipulate, and query tables: myhost> java -Dcloudscape.system.home=%J2EE_HOME%\cloudscape \ -classpath %J2EE_HOME%\lib\cloudscape\tools.jar; %J2EE_HOME%\lib\cloudscape\cloudscape.jar; %J2EE_HOME%\lib\cloudscape\license.jar;%CLASSPATH% \ -ms16m -mx32m DatabaseTool(type the above all on the same line, with the classpath all together). Using DatabaseTool to view the MusicCD table will look something
like this: In many cases, using DatabaseTool is faster than using the database vendor's viewing tools. Next ExerciseExercisesShort CourseCopyright 1996-2000 jGuru.com. All Rights Reserved. |