Java stored procedures in Oracle databases can use JMSL to call actual AQ operations. We can use the four frequently used steps below to implement this mode. To create and start the JMS Queue, We can embed the following operations into the SQL script ):
- execute dbms_aqadm.create_queue_table(queue_table =>
''queue1'', queue_payload_type => ''SYS.AQ$_JMS_TEXT_MESSAGE'',
comment => ''a test queue'', multiple_consumers => false,
compatible => ''8.1.0'');
execute dbms_aqadm.create_queue
( queue_name => ''queue1'', queue_table => ''queue1'' );
execute dbms_aqadm.start_queue(queue_name => ''queue1'');
The following is an excerpt from the code used to create a Java stored procedure ):
- public static void runTest(String msgBody)
{ try { // get database connection ora_drv = new OracleDriver();
db_conn = ora_drv.defaultConnection();
// setup sender (cf online code sample) ..
// create message s_msg = s_session.createTextMessage(msgBody);
// send message sender.send(s_msg); s_session.commit();
// receive message r_msg = (TextMessage) receiver.receive();
r_session.commit();
// output message text String body = r_msg.getText();
System.out.println("message was ''"+body+"''"); ..} }
Create Call Spec:
- create or replace procedure jmsproc
(t1 IN VARCHAR) as language java name
''jmsSample.main (java.lang.String[])''; /
Call the stored procedure:
- call jmsproc(''hello'');
The Web Publishing buffer assisted by the Oracle database is invalid)
A common problem that application structures must face is that database information is reliably cached to improve the performance of the entire system. JCACHE is the standard specification JSR 107 to be published soon. It can solve this problem. It illustrates a method for temporarily caching Java objects in the memory, including object creation, shared access, spooling off-line, failure, and JVM consistency.
It can be used to cache the most frequently read data in JSP, such as the product catalog and price list. Using JCACHE, the response time of most queries will be accelerated by cache data. Internal tests show that the response time is about 15 times faster ).
To track all changes to the original data and refresh the cached data, the Java stored procedure is attached to a table as a trigger. Any changes to this table will automatically call the stored procedure. The latter calls up a defined JSP to invalidate the JCACHE object and maps its status to the Oracle database table.
When it fails, the query that follows it will force the cache to update based on the database data. The following steps read more about Java Stored Procedures this article is taken from the White Paper "release the energy of Java Stored Procedures Unleash the Power of Java Stored Procedures)", you can find this White Paper in the following locations:
- otn.oracle.com/tech/java/java_db/pdf/
- OW_30820_JAVA_STORED_PROC_paper.PDF
New PL/SQL features in Oracle9i Database 2nd
- otn.oracle.com/tech/pl_sql/pdf/
- Paper_30720_Doc.pdf
- Resolver Spec
- otn.oracle.com/docs/products/oracle9i/
- doc_library/release2/java.920/a96659.pdf
- OracleJVM and Java 2 Security
- otn.oracle.com/docs/products/oracle9i/
- doc_library/release2/java.920/a96656.pdf
The above content describes the actual operations that can be performed to call AQ using JMSL for Java stored procedures in Oracle databases. We hope this will help you in this regard.