// show cart ---------- String sql = "Select bid from Cart where cID=?"; mystmt = myConn.prepareStatement(sql); mystmt.setInt(1,cID); myRs = myStmt.executeQuery(); System.out.println(Books with following book IDs are there in cart"); while(myRs.next()){ int Book_id = myRs.getInt("bID"); System.out.println(Book_id); } //Add book to cart---------- String sql = "Insert into Cart "+"(cID,bID) "+values (?,?)"; myStmt = myConn.prepareStatement(sql); myStmt.setInt(1,cId); myStmt.setInt(2,bookID); myStmt.execute(); //remove from cart------- String sql = "Delete from Cart where cID = ? and bID = ?"; myStmt = myConn.prepareStatement(sql); myStmt.setInt(1,cID); myStmt.setInt(2,bookID); myStmt.execute(); //Show orders------- String sql = "Select * from Orders where cID = ?"; myStmt = myConn.prepareStatement(sql); myStmt.setInt(1,cID); myRs = myStmt.executeQuery(); System.out.println("Order ID Book ID"); while(myRs.next()){ int order_id = myRs.getInt("oID"); int book_id = myRs.getInt("bID"); System.out.println(oID+" "+bID); }