Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
Print Button
 

Setting up the Database


by jGuru

[Exercise | API Docs | Short Course| Exercises]

Help is available for each task.



    Task 1

    Choose a database system appropriate for your environment and then either install or build the database system with the music data that you prefer.


    Sun's J2EE Reference Implementation comes with a built-in version of the Cloudscape RDBMS. If you are using J2EE RI, you should initially use Cloudscape as your database to avoid configuration problems. You can learn how to substitute a different database after you become comfortable with creating and deploying applications using Cloudscape.

    If you insist on initially using a database other than Cloudscape, you should carefully read and follow the instructions in the following J2EE RI documentation before you begin:

    Note that Microsoft Access doesn't provide adequate SQL support for the tasks required by EJB technology servers.

    For Cloudscape, simply copy the MusicStoreDB.jar archive into the directory %J2EE_HOME%\cloudscape and then unjar the database. (All files unjar into the directory MusicStoreDB within the current working directory.)

    For other database environments, simply compile and run the programs MusicCDCreateTables.java and MusicCDInsertRecords.java after creating an empty database. You can modify the source for the appropriate driver and URL values, or supply them as command-line options. You can also perform these tasks using DatabaseTool, or JDBCTest (TestTool) from the Sun's JDBC area.

    One last step is needed when running with J2EE RI: You need to modify the %J2EE_HOME%\config\default.properties file to define the datasources available to J2EE RI. This is done by changing the line that reads:

    jdbc.datasources=jdbc/Cloudscape|
      jdbc:cloudscape:rmi:CloudscapeDB;create=true
    

    (with everything on one line)

    to be:

    jdbc.datasources=jdbc/Cloudscape|
      jdbc:cloudscape:rmi:CloudscapeDB;create=true|
      jdbc/MusicStore|jdbc:cloudscape:rmi:MusicStoreDB;create=false
    

    (with everything on one line)

    and then restarting both Cloudscape and J2EE RI.

    Barnes and Noble and other sites provide easy access to music CD data such a UPCs, if you want to customize the MusicCD database with your own entries.

    Task 2

    Verify the integrity of the database using a vendor-supplied graphical tool or the DatabaseTool.java program provided.


    See the expected output in this exercise for example output for the Cloudscape View tool and for DatabaseTool.java.

Copyright 1996-2000 jGuru.com. All Rights Reserved.


Print Button
[ This page was updated: 14-Apr-2000 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.