Skip Headers

Oracle® interMedia User's Guide
10g Release 1 (10.1)

Part Number B10840-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

A Sample Programs

Oracle interMedia includes a number of scripts and sample programs that you can use. These consist of SQL, OCI, Java, PL/SQL, and ASP/VBScript sample applications (demos).

Sample interMedia SQL, Java, and OCI applications are available in the following directories after you install interMedia:

On UNIX
<ORACLE_HOME>/ord/aud/demo/
<ORACLE_HOME>/ord/doc/demo/
<ORACLE_HOME>/ord/img/demo/
<ORACLE_HOME>/ord/vid/demo/
<ORACLE_HOME>/ord/http/demo/
<ORACLE_HOME>/ord/im/demo/java.101/

On Windows
<ORACLE_HOME>\ord\aud\demo\
<ORACLE_HOME>\ord\doc\demo\
<ORACLE_HOME>\ord\img\demo\
<ORACLE_HOME>\ord\vid\demo\
<ORACLE_HOME>\ord\http\demo\
<ORACLE_HOME>\ord\im\demo\java\

A.1 Sample Audio SQL Scripts

The audio SQL scripts consist of the following files:

See the README.txt file in the <ORACLE_HOME>/ord/aud/demo directory on UNIX and <ORACLE_HOME>\ord\aud\demo directory on Windows for requirements and instructions on running this SQL demo.

See Section A.5 for a description of the Java sample application that is provided to help you learn to use the multimedia client-side Java classes so you can build your own applications.

A.2 Sample ORDDoc SQL Scripts

The ORDDoc SQL scripts consist of the following files:

See the README.txt file in the <ORACLE_HOME>/ord/doc/demo/ directory on UNIX and <ORACLE_HOME>\ord\doc\demo\ directory on Windows for requirements and instructions on running this SQL demo.

See Section A.5 for a description of the Java sample application that is provided to help you learn to use the multimedia client-side Java classes so you can build your own applications.

A.3 Sample OCI C Program for Modifying Images or Testing Image Installation

Once you have installed interMedia, you may choose to run the interMedia image OCI C program. This program can also be used as a test to confirm successful installation.

This section describes how to run the interMedia image sample program.

The interMedia image sample files are located in <ORACLE_HOME>/ord/img/demo on UNIX and <ORACLE_HOME>\ord\img\demo on Windows where <ORACLE_HOME> is the Oracle home directory.

A.3.1 Sample Program Installation Steps

For interMedia image features, see the README.txt file at <ORACLE_HOME>/ord/img/demo (on UNIX), and <ORACLE_HOME>\ord\img\demo (on Windows), where <ORACLE_HOME> is the Oracle home.

A.3.2 Running the Program

The file imgdemo.c is a sample program that shows how interMedia image features can be used from within a program. The program is written in C and uses OCI, Oracle Call Interface, to access the database and use interMedia image features.

The program operates on imgdemo.dat, which is a bitmap (BMP) image in the demo directory. Optionally, you can supply an image file name on the command line, provided the file resides in the same directory as the program. In either case, once the image has been manipulated by interMedia, the resulting image is written to the file imgdemo.out and can then be viewed with common rendering tools that you supply.

When the program is run, it deletes and re-creates a table named IMGDEMOTAB in the SCOTT/TIGER schema of the default database. This table is used to hold the program data. Once the table is created, a reference to the image file is inserted into the table. The data is then loaded into the table and converted to JFIF using the processCopy( ) method of ORDImage.

The image properties are extracted within the database using the setProperties( ) method. An UPDATE statement is issued after the setProperties( ) invocation. This is required to make the object attributes permanent because the setProperties( ) invocation has updated only a local copy of the type attributes.

Next, the process( ) method is used to cut and scale the image within the database. This is followed by an update that commits the change. The program cuts a portion of the image 100 pixels wide by 100 pixels high, starting from pixel location (100,100). This subimage is scaled to twice its original size and the resulting image is written out to the file system in a file named imgdemo.out.

Upon completion, the program leaves the imgdemo.out file in the current directory. It also leaves the table IMGDEMOTAB in the SCOTT/TIGER schema of the database.

Execute the program by typing imgdemo on the command line.

Use the command shown in Example A-1.

Example A-1 Execute the Sample Program from the Command Line

$ imgdemo <optional-image-filename>

The program displays a number of messages describing its progress, along with any errors encountered in the event that something was not set up correctly. Expect to see the following messages:

Dropping table IMGDEMOTAB... 
Creating and populating table IMGDEMOTAB... 
Loading data into cartridge... 
Modifying image characteristics... 
Writing image to file imgdemo.out... 
Disconnecting from database... 
Logged off and detached from server. 
Demo completed successfully. 

If the program encounters any errors, it is likely that either interMedia software has not been installed correctly, or the database has not been started. If the program completes successfully, the original image and the resulting image, which has undergone the cutting and scaling described earlier, can be viewed with common image rendering tools.

See Section A.5 for a description of the Java sample application that is provided to help you learn to use the multimedia client-side Java classes so you can build your own applications.

A.4 Sample Video SQL Scripts

The video SQL scripts consist of the following files:

See the README.txt file in the <ORACLE_HOME>/ord/vid/demo directory on UNIX and <ORACLE_HOME>\ord\vid\demo directory on Windows for requirements and instructions on how to run this SQL demo.

See Section A.5 for a description of the Java sample application that is provided to help you learn to use the multimedia client-side Java classes so you can build your own applications.

A.5 Java Sample Applications

An IMExample Java sample application has been provided to help you learn to use the audio, video, image, and media (ORDDoc) client-side Java classes so you can build your own applications. In this sample application, the sample schema is used to demonstrate the use of the OrdAudio, OrdVideo, OrdImage, and OrdDoc Java objects.

See the README.txt file in the <ORACLE_HOME>/ord/im/demo/java directory on UNIX and <ORACLE_HOME>\ord\im\demo\java directory on Windows for requirements and instructions on how to run this Java sample application. See Chapter 4 for a description of this Java sample application. See Oracle interMedia Java Classes Reference for information about using Oracle interMedia Java Classes.

The IMExample Java sample application files are located in:

<ORACLE_HOME>/ord/im/demo/java (on UNIX)

<ORACLE_HOME>\ord\im\demo\java (on Windows)

The interMedia Java Servlet Photo Album application shows how to use interMedia Java Classes for servlets and JSP to upload and retrieve multimedia data. See the README.txt file at:

<ORACLE_HOME>/ord/http/demo/servlet (on UNIX)

<ORACLE_HOME>\ord\http\demo\servlet (on Windows)

The interMedia JavaServer Pages Photo Album application shows how to use interMedia Java Classes for servlets and JSP to upload and retrieve multimedia data. See the README.txt file at:

<ORACLE_HOME>/ord/http/demo/jsp (on UNIX)

<ORACLE_HOME>\ord\http\demo\jsp (on Windows)

A.6 Additional PL/SQL Sample Packages

Two additional PL/SQL sample application packages are available after installing interMedia. These packages include:

A.7 Additional ASP/VBScript Sample Application

The interMedia ASP/VBScript Photo Album application illustrates how to upload and retrieve multimedia data with an ASP/VBScript application. See the README.txt file at:

<ORACLE_HOME>/ord/http/demo/asp (on UNIX)

<ORACLE_HOME>\ord\http\demo\asp (on Windows)

A.8 Other Sample Programs

See the program examples available from the interMedia Web page on the Oracle Technology Network at

http://otn.oracle.com/sample_code/products/intermedia/content.html

Sample SQL scripts that demonstrate how to set up a schema on your database are also included on the Oracle Technology Network Web site.