
|
| Query | |
|
| Properties | |
|
| ||
|
| ||
|
| ||
|
| ||
|
| ||
|
| ||
|
| ||
Servlet | instantiate | ||
SQLToXML | |||
|
| ||
|
| execute | |
|
| XML Document | |
Figure | SQLToXML |
| |
Initializing the SQLToXML class
We created a separate initQueryProperties method to setup the property. Since we use same property during this application running, we initialize this property in the init method.
Add QueryProperties as a global variable:
private QueryProperties queryProperties;
Add initQueryProperties method (Example
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");