</xsl:template>

11.3.5 Retrieving a customer

We used SQLToXML library to retrieve a customer.

The SQLToXML takes one parameter to initialize. That parameter is the

QueryProperty class and it contains following data:

JdbcDriver

JDBC driver name

LoginId

Database login ID

Password

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 generates the result as an XML form and disconnects from the database (Figure 11-8).

The host variable can be set as comma delimited. 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

270 The XML Files: Development of XML/XSL Applications Using WebSphere Studio

Page 286
Image 286
IBM Version 5 manual Retrieving a customer, JdbcDriver, Statement, Format, Recurse