Databases Reference
In-Depth Information
createPorder(poid):
This calls a stored procedure to create the XML value.
Example 5-1 OrderProcess class
import java.sql.*;
import java.util.*;
import com.ibm.db2.jcc.*;
public class OrderProcess {
private Connection con=null;
private String[] products=null;
private int cid=0;
public static void main(String args[])
{
String[] products=null;
OrderProcess op=new OrderProcess();
int custid=1001;
HashMap hm=new HashMap();
hm.put("Snow Shovel, Deluxe 24 inch",4);
hm.put("Snow Shovel, Basic 22 inch",5);
op.getConnection();
products=op.getProducts();
for(int i=0;i<products.length && products[i]!=null ;i++)
{
System.out.println(products[i]);
}
String name=op.isCustomer(custid);
if(name!=null)
{
op.dropCart();
op.createCart(hm);
Double price = op.findTotal();
System.out.println("your total is " +price);
op.updateTable();
}
}
public void getConnection()
{
try {
if(con==null)
{
Search WWH ::




Custom Search