Java
Messaging Service Sample - Readme
This document is organized
into following sub-sections :
Overview of the Sample Application
|
This sample demonstrates Java Messaging Services. A message queue
is created in the database by running the SQL script setup.sql. A Java
Stored procedure is used to create a sender and receiver for the queue.
The Java Stored Procedure takes a String as input and creates a message
with the String and uses the sender to send the message. The message is
received by the receiver. The receiver just displays the message.
Installation and Configuration
|
|
This section explains the steps to be followed
to install and configure the sample application.
Required Software
- Oracle9i Database version 9.0.1 or later. You
can download
the Oracle9i database from the Oracle Technology
Network.
Notation Used
This section will describe the terms used in the document.
For example,
- %SAMPLE_HOME%- The directory where the JMSSample.jar
file was unzipped to. This directory contains the JMSSample
directory
- %ORACLE_HOME% - The directory where the Oracle9i
Client or Database software is installed
Extracting the source code
The application files are stored in an archive named JMSSample.jar.
Download the archive and extract it to a convenient directory
(%SAMPLE_HOME%). Execute following command to extract the
files:
jar xvf JMSSample.jar
The archive JMSSample.jar extracts the files that implement
the JMS Sample. All the files are extracted into the JMSSample
directory. This directory will have all the sources as described
in the Files section.
Configuring the application
1. This demo requires a message queue to be created and start the
queue to run the demo. The script for creating the queue is provided in
the file setup.sql located in the directory %SAMPLE_HOME%/JMSSample/config.
Execute the script setup.sql. Connect to your database
as any user and run the following command from the SQL prompt
SQL>@%SAMPLE_HOME%/JSM/config/setup.sql
This creates a new database user "jms1" (password - "jms1")
with all the required privileges.
2. Ensure that %ORACLE_HOME%\bin is in the system
path. This demo requires the Java Stored Procedure to be loaded to
the database. This is done from a command prompt as shown below
:
loadjava -thin -user jms1/jms1@<hostname>:<port>:<SID>
-resolve -verbose %SAMPLE_HOME%/JMSSample/src/jmsSample.java
where,
|
hostname
|
host name where the database is installed
|
|
port
|
TNS listener port of the database
|
|
SID
|
database name
|
For example,
loadjava -thin -user jms1/jms1@insn104a.idc.oracle.com:1521:otn9idb -resolve
-verbose c:\JMSSample\src\jmsSample.java
3. The Java Stored Procedure loaded in the previous step needs to
be published This is done by the jmsSpec.sql
Connect to your database as any user and run the script jmsSpec.sql
at the SQL prompt :
SQL>@%SAMPLE_HOME%/JMSSample/config/jmsSpec.sql
This sql script publishes the stored procedure created in the previous
step to the database.
You can see the sample working by running the SQL script jmsCall.sql.
SQL>@%SAMPLE_HOME%/JMSSample/config/jmsCall.sql
You can see the output on the SQLPlus.
Description of Sample Files
|
|
| Directory |
Filename |
Description |
| JMSSample/config |
setup.sql |
The sql script used to create a database
user and the database queue |
| jmsSpec.sql |
The sql script used to publish the
java stored procedure to the database |
| jmsCall.sql |
The sql script used to call the queue |
| JMSSample/doc |
Readme.html |
This file |
| JMSSample/src |
jmsSample.java |
Java Stored Procedure
that calls out the Web Service to get the current Temperature |
Please
enter your comments about this sample in the OTN Sample Code
Discussion Forum. |