Collection Contents Index CHAPTER 17.  Using Java in the Database Managing the runtime environment for Java pdf/chap17.pdf

User's Guide
   PART 3. Java in the Database
     CHAPTER 17. Using Java in the Database       

Overview of using Java


This chapter describes how to accomplish tasks using Java in the database, including the following:

Top of page  Installing the Java examples

Many of the examples in this chapter are carried out using a set of classes and tables added to the sample database. The tables hold the same information as tables of the same name in the sample database, but they are owned by a user ID named jdba. They use Java class data types instead of simple relational types to hold the information.

Sample tables designed for tutorial use only    
The sample tables are designed to illustrate different Java features. They are not a recommendation for how to redesign your database. You should consider your own situation in evaluating where to incorporate Java data types and other features.

  To add the Java classes and tables to the sample database:
  1. Connect to the sample database from Interactive SQL, using the user ID DBA and password SQL, ensuring that the database server has 8 Mb of cache available.

    You can do this by starting Interactive SQL from the Start menu, and selecting the ASA 6.0 Sample data source in the Connection window.

    Alternatively, you can start Interactive SQL from the command line, connecting to the ASA 6.0 Sample data source:

    dbisql -c "dsn=ASA 6.0 Sample"
  2. In Interactive SQL, enter the following statement:

    READ "path\jxmp\jdemo.sql"

    where path is your Adaptive Server Anywhere installation directory. This runs the instructions in the jdemo.sql command file. The instructions may take some time to complete.

You can view the jdemo.sql script using a text editor. It uses out the following steps:

  1. Installs the JDBCExamples class.

  2. Creates a user ID named JDBA with password SQL and DBA authority, and sets the current user to be jdba.

  3. Installs a JAR file named asademo.jar. This file contains the class definitions used in the tables.

  4. Creates the following tables under the jdba user ID:

    This is a subset of the tables in the sample database.

  5. Adds the data from the standard tables of the same names into the Java tables. This step uses INSERT from SELECT statements. This step may take some time.

  6. Creates some indexes and foreign keys to add integrity constraints to the schema.

Top of page  

Collection Contents Index CHAPTER 17.  Using Java in the Database Managing the runtime environment for Java pdf/chap17.pdf