270 The XML Files: Develo pment of XML/XSL Applications Using WebS phere Studio
</xsl:template>
11.3.5 Retrieving a customer
We used SQLToXML library to retrieve a customer.
The SQLToXML takes one parameter to in itialize. That parameter is the
QueryProperty class and it contains following data:
JdbcDriver JDBC driver name
LoginId Database login ID
Passwor d Database login password
JdbcServer Server name (ex. jdbc:db2:Airline)
Statement Query statement
Format Use GENERATES_AS_ELEMENTS
Recurse False
Once the SQLToXML is instantiate, invoke the execute method to query. The
execute method takes a parameter to set a host variable. SQLToXML connects to
the database and executes a query then ge nerates the result as an XML form
and disconnects from the database (Figure 11-8).
The host variable can be set as comma deli mited. For example, to set two
variables for the following select statement, the parameter will be new
String(“Air Canada 700, Jet 787”);
SELECT * FROM PASSENGER, SCHEDULE
WHERE PASSENGER.FLIGHT = SCHEDULE.FLIGHTNO
AND PASSENGER.FLIGHT = :flight
AND SCHEDULE.AIRCRAFT = :aircraft