09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

General Features of <strong>Advanced</strong> <strong>Queuing</strong><br />

CREATE OR REPLACE TYPE orderitemlist_vartyp AS VARRAY (20) OF orderitem_typ;<br />

An order is modeled as an object type called order_typ. The order type is a<br />

<br />

composite type that includes nested object types defined earlier. The order type<br />

captures details of the order, the customer information, and the item list.<br />

CREATE OR REPLACE TYPE order_typ as object (<br />

orderno NUMBER,<br />

status VARCHAR2(30),<br />

ordertype VARCHAR2(30),<br />

orderregion VARCHAR2(30),<br />

customer CUSTOMER_TYP,<br />

paymentmethod VARCHAR2(30),<br />

items ORDERITEMLIST_VARTYP,<br />

total NUMBER);<br />

Some queues in the BooksOnline application model an order using a<br />

<br />

SYS.XMLType payload.<br />

Visual Basic (OO4O): Example Code<br />

Use the dbexecutesql interface from the database for this functionality.<br />

Java (JDBC): Example Code<br />

After creating the types, use JPublisher to generate Java classes that map to the SQL<br />

types.<br />

1. Create an input file "jaqbol.typ" for JPublisher with the following lines:<br />

TYPE boladm.customer_typ as Customer<br />

TYPE boladm.book_typ as Book<br />

TYPE boladm.orderitem_typ AS OrderItem<br />

TYPE boladm.orderitemlist_vartyp AS OrderItemList<br />

TYPE boladm.order_typ AS Order<br />

2. Run JPublisher with the following arguments:<br />

jpub -input=jaqbol.typ -user=boladm/boladm -case=mixed -methods=false<br />

-compatible=CustomDatum<br />

This will create Java classes Customer, Book, OrderItem and OrderItemList that<br />

map to the SQL object types created earlier:<br />

3. Load the Java AQ driver and create a JDBC connection:<br />

public static Connection loadDriver(String user, String passwd)<br />

A Sample Application Using AQ 8-13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!