Chapter 11. Light weight XML-based Enterprise Application 271
Figure 11-8 SQLToXML
Initializing the SQLToXML class
We created a separate initQueryProperties method to setup the proper ty. Since
we use same property during t his application running, we initialize this pr operty
in the init method.
򐂰Add QueryProperties as a g lobal variable:
private QueryProperties queryProperties;
򐂰Add initQueryProperties met hod (Example 11-7).
򐂰In the init method, add a statement to invoke the initQueryProperties method.
initQueryProperties();
򐂰Also, we instantiated SQLToXML in the init method:
sql2xml = new SQLToXML(queryProperties);
Example 11-7 initQueryProperties method
private void initQueryProperties()
{
queryProperties = new QueryProperties();
queryProperties.setJdbcDriver(
"COM.ibm.db2.jdbc.app.DB2Driver");
queryProperties.setLoginId("db2admin");
queryProperties.setPassword("db2admin");
queryProperties.setJdbcServer("jdbc:db2:AIRLINE");
queryProperties.setStatement(
"SELECT * FROM CUSTOMER WHERE SERIAL = :membership");
XML Document
Query
Properties
-JdbcDriver
-LoginID
-Password
-JdbcServer
-Statement
-Format
-Recurse
execute
Servlet instantiate
SQLToXML