beautypg.com

Customizing jpetstore, Added file, Setdatabase.java – HP Integrity NonStop H-Series User Manual

Page 156: Modified files, Build_jdbct2.xml

background image

# - This is the IP address of your NonStop system
# - This is the Port Number of JDBC Data Source
# - This is the HP NonStop system UserName
# - This is the HP NonStop system Password

Customizing JPetStore

To customize the JPetStore sample application to run on NonStop systems, one file was added
and six files were modified:
Added File:

SetDatabase.java

Modified Files:

build_jdbct2.xml

build_jdbct4.xml

Item.xml

dataAccessContext-local.xml

jdbc.properties

Order.xml

Added File

The following file was added to customize JPetStore:

SetDatabase.java

(\jpetstore\src\org\springframework\samples\jpetstore\
property\SetDatabase.java)

:

A new package

org.springframework.samples.jpetstore.property

and a Java class

SetDatabase.java

was created. The

SetDatabase.java

class file is used for adding

customized connection properties to the JDBC driver.
The

SetDatabase.java

class file appeared as:

package org.springframework.samples.jpetstore.property;
import org.apache.commons.dbcp.BasicDataSource;
public class SetDatabase extends BasicDataSource{
private String catalog;
private String schema;
public void setCatalog(String catalog) {
this.catalog=catalog;
addConnectionProperty("catalog",this.catalog);
}

public void setSchema(String schema) {
this.schema=schema;
addConnectionProperty("schema",this.schema);
}

Modified Files

The following files were modified to customize JPetStore:

build_jdbct2.xml

(\jpetstore\src\org\springframework\samples\jpetstore\
property\build_jdbct2.xml):

This is the build file for JPetStore when using the JDBC Type 2 driver for database connectivity.

156

Customizing Sample Applications

This manual is related to the following products: