This section demonstrates how you can store the data from XML documents in a Sybase IQ database using the ResultSet class and its methods for handling result sets. You can customize the ResultSet class for your database application.
Contrast the ResultSet document type and the Order document type:
The Order document type is a simplified example designed for a specific purchase-order application, and its Java methods are designed for a specific set of SQL tables for purchase order data. See “Storing XML data in a Sybase IQ database”.
The ResultSet document type is designed to accommodate many kinds of SQL result sets, and the Java methods designed for it include parameters to accommodate different kinds of SQL queries.
For this example, you create and work with XML ResultSet documents that contain the same data as the XML Order documents.
First, create the orders table and its data:
create table orders (customer_id varchar(5) not null, order_date datetime not null, item_id varchar(5) not null, quantity int not null, unit smallint default 1)
insert into orders values ('123', '1999/05/07', '987', 5, 1) insert into orders values ('123', '1999/05/07', '654', 3, 12) insert into orders values ('123', '1999/05/07', '579', 1, 1)