 Copyright (c) Oracle Corporation 1998, 1999. All Rights Reserved.

   NAME
     README.txt -  ORACLE8i interMedia Audio Java Demo

=====================================================================

Contents
--------
1.   INTRODUCTION
2.   SQL DEMO
2.1  INTRODUCTION TO SQL DEMO
2.2  REQUIREMENTS FOR RUNNING THE SQL DEMO
2.3  RUNNING THE SQL DEMO
3.   JAVA DEMO
3.1  INTRODUCTION TO JAVA DEMO 
3.2  COMPILING THE JAVA DEMO
3.3  REQUIREMENTS FOR RUNNING THE JAVA DEMO
3.4  RUNNING THE JAVA DEMO

1. INTRODUCTION
---------------
In this readme file, a description of two demos present in the demo
directory has been provided along with the instruction to setup
and run these demos. Since the demos are written in JAVA and PL/SQL
there is no makefile for building these demos. Users can follow
the instruction in this file to execute these demos.

1.1 INTRODUCTION TO SQL DEMO
----------------------------
This demo is designed to allow users to write their own PL/SQL
code to access and manipulate data in the Audio object. There are
some additional statements provided to aid users in verifying
the installation and unsing certain interfaces such as importing
data from an intranet web site. These methods are difficult to
test using automated testing mechanism therefore these are commented 
out using the following:
> ----------------------------------------------------------
> -- THE NEXT LINE HAS BEEN COMMENTED FOR AUTOMATED TESTING
> -- PLEASE UNCOMMENT IT TO TRY OUT THE COMMAND.
> ----------------------------------------------------------
Users can try out these statements in their environmet
after the desired environment has been set. The SQL demo file
has comments embedded in the file for users to understand 
the processing. Users should try to read the comments before 
executing anonymous blocks.

2.2 REQUIREMENTS FOR RUNNING THE SQL DEMO
-----------------------------------------
The following is required for the SQL demo to run:

1. install oracle8i server.
2. install interMedia.
3. Create user audiotest with password audiotest
   If you wish to use a diferent user then update
   auddemo.sql to use correct username and password.
4. Create DIRECTORY object AUDIODIR and grant access
   to your user. If you wish to use a different DIRECTORY
   update auddemo.sql to reflect that.
5. Make sure that testaud.dat is present
   in your DIRECTORY. Again if you wish to use your own
   audio file (e.g. audio.au) update auddemo.sql to
   reflect that.
6. If you wish to try URL import then make sure that
   you have a valid URL pointing to valid audio file and
   uncomment and update the URL and audio file name to reflect
   that.
7. Reasonable amount of tablespace allocated to the user
8. DEMO plugins (fplugins.sql and fpluginb.sql) installed
   in ORDPLUGINS schema and EXECUTE privileges granted
   on ORDX_DEMO_AUDIO to public or at least to your user.

1.3 RUNNING THE SQL DEMO
------------------------
SQL demo is a collection of SQL statements and anonymous PL/SQL
blocks. The order in which these statements are executed is
important because statement higher up in the order set up
the data/object for the following statements to succeed. Users
can run this entire file or run each block in order to see
and understand the results better. It is recommended that 
first time users should try to run one block at a time to 
help debug any problems.  

The SQL demo is auddemo.sql.

2.1 INTRODUCTION TO JAVA DEMO
-----------------------------
The Java demo has been provided to the users to help them learn how
to use the Audio client side java classes to build their own applications.
In this demo, the audio object is being instantiated at the client side
and number of accessor methods are invoked. Use of getDataInFile 
method has also been demonstrated for the users who wish to download 
data on the client machine. loadData method (not present in demo) can be 
used to upload the data. Some update methods have also been demonstrated 
in this demo.

2.2 COMPILING THE JAVA DEMO
---------------------------
The demo program should be compiled using the jdk1.1.2 version of java 
package. The user needs to compile using javac compiler. They need to make sure
that the dbjava classes111.zip and ordmm.zip and jdk zip classes are in their 
CLASSPATH and javac and java are available in their PATH.

2.3 REQUIREMENTS FOR RUNNING THE JAVA DEMO
------------------------------------------
Before running the demo, users MUST have done the following:

1. install oracle8i server.
2. install interMedia.
3. create a table with one column of type OrdAudio.
4. insert a few rows in the table.

For step 3 and 4 users can use the following as an example:

      -- CREATE TABLESPACE
      CREATE TABLESPACE tabspace_1
         DATAFILE 'tabspace_file1.dbf' SIZE 100M
         MINIMUM EXTENT 64K
         DEFAULT STORAGE (INITIAL 128K NEXT 128K)
         LOGGING;

      -- CREATE THE USER AND ASSIGN THE TABLESPACE
      CREATE USER ordmediademo IDENTIFIED BY ordmediademo
               DEFAULT TABLESPACE tabspace_1;


      -- GRANT PRIVILEGES
      GRANT CONNECT, RESOURCE, CREATE LIBRARY TO ordmediademo;
      GRANT CREATE ANY DIRECTORY TO ordmediademo;
      CONNECT ordmediademo/ordmediademo;

      -- CREATE DIRECTORY TO LOAD DATA FROM
      -- FOR USERS ON WINDOWS-NT THIS STATEMENT WILL BE DIFFERENT

      -- ON UNIX
      CREATE OR REPLACE DIRECTORY AUDIODIR AS '/tmp/' ;
      -- ON WINDOWS-NT
      CREATE OR REPLACE DIRECTORY AUDIODIR AS 'C:\Temp' ;

      -- CREATE TABLE
      CREATE TABLE TAUD(n NUMBER, aud ORDSYS.ORDAUDIO)
      STORAGE (INITIAL 100K NEXT 100K PCTINCREASE 0);

      -- INSERT A NULL ROW
      INSERT INTO TAUD VALUES( 1, ORDSYS.ORDAudio.init() );

      -- LOAD DATA FROM AUDIODIR
      DECLARE
        obj ORDSYS.ORDAudio;
        ctx RAW(4000) := NULL;
      BEGIN
        SELECT aud INTO obj FROM TAUD  WHERE N=1 FOR UPDATE;
        DBMS_OUTPUT.PUT_LINE('setting and getting source');
        DBMS_OUTPUT.PUT_LINE('--------------------------');
       
        -- set source to a file
        obj.setSource('FILE','AUDIODIR','testaud.dat');
        -- get source information
        DBMS_OUTPUT.PUT_LINE(obj.getSource);
       
        -- import data
        obj.import(ctx);
        -- check size
        DBMS_OUTPUT.PUT_LINE(TO_CHAR(obj.getContentLength(ctx)));
        DBMS_OUTPUT.PUT_LINE(obj.getSource);
        UPDATE TAUD SET aud=obj WHERE N=1;
        COMMIT;
      END;
      /

      NOTE:
      -----
      The above example has been provided to assist users in creating 
      a table with audio data in it. Users should try modifying it to 
      setup their own database and tables. In the above example 
      testaud.dat file is the media data file which needs to be in 
      the AUDIODIR, before running the sql scripts.

2.4 RUNNING THE JAVA DEMO
-------------------------
The user can run the demo using the following command:
    java demoProgram

The Solaris user needs to make sure that the directory in which libocijdbc8.so 
resides in their machine is in their LD_LIBRARY_PATH variable, and the NT user
needs to make sure that the directory in which libocijdbc8.dll resides in their
machine is in their PATH variable before running the demoProgram.

Once started the program will prompt the user to enter the binding parameters
which are, table name, column name, and search condition. The user needs to 
enter these three parameters. If the user is using the ademoProgram.sql
file to create their data base then these parameters could be:
Enter your search parameters
Enter table Name
TAUD     <====== users response
Enter column Name
aud      <====== users response
Enter Data Condition
N = 1    <====== users response


Then the program will go ahead and connect to the database, create a 
client side audio object instance and bind it to an appropriate server
side instance. Thereafter it will refresh the client side object and perform
operations on it, and finally flush it back to the database.

------------------------------------------------------------------------
