Dataaccesscontext-local.xml, Jdbc.properties – HP Integrity NonStop J-Series User Manual
Page 140

Changes to the Item.xml file
Before the change:
<select id="getInventoryQuantity" resultclass="java.lang.integer">
select qty as value from inventory where itemid = #value#
</select>
After the change:
<resultMap id="result-for-quantity" class="java.lang.Integer">
<result property="qty" column="qty" />
</resultMap>
<select id="getInventoryQuantity" resultMap="result-for-quantity">
select qty from inventory where itemid = #value#
</select>
dataAccessContext-local.xml
(<My SASH Home>\spring\samples\jpetstore\src\main\webapp\WEB-INF\
dataAccessContext-local.xml)
The dataAccessContext-local.xml file contains all the configuration metadata for JPetStore.
The bean with the dataSource ID in the dataAccessContext-local.xml file was modified to
use the customized SetDatabase class instead of the BasicDataSource class.
Changes to the dataAccessContext-local.xml file
Before the change:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
After the change:
<bean id="dataSource" class="org.springframework.samples.jpetstore.property.SetDatabase">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="catalog" value="${jdbc.catalog}"/>
<property name="schema" value="${jdbc.schema}"/>
</bean>
jdbc.properties
(<My SASH
Home>\spring\samples\jpetstore\src\main\webapp\WEB-INF\jdbc.properties)
This is the configuration file for connecting to the SQL/MX database. This file was modified to add
the SQL/MX JDBC properties instead of the default HSQL JDBC properties used by JPetStore.
Changes to the jdbc.properties file
The following modifications were made to set the JDBC properties for the SQL/MX database:
•
The HSQL Settings section that includes the JDBC properties and the HSQL dialect file name
was commented.
•
The SQL/MX Settings section that includes the JDBC Type 2 and Type 4 drivers was added.
Before the change:
# Properties file with JDBC-related settings.
# Applied by PropertyPlaceholderConfigurer from "dataAccessContext-local.xml".
# Targeted at system administrators, to avoid touching the context XML files.
jdbc.driverClassName=org.hsqldb.jdbcDriver
jdbc.url=jdbc:hsqldb:hsql://localhost:9002
140 Customizing Sample Applications