beautypg.com

Configurations in the applicationcontext.xml file, Defining the placeholder for connection url, Wiring of jdbc properties – HP Integrity NonStop H-Series User Manual

Page 79: Configurations in the, Applicationcontext.xml, File

background image

jdbc.username=
jdbc.password=

Configurations in the

applicationContext.xml

File

For making necessary JDBC configurations, you need to create the

applicationContext.xml

file and complete the following activities:

1.

Defining the Placeholder for JDBC Type 4 Driver Class

2.

Defining the Placeholder for Connection URL

3.

Defining the Placeholder for Establishing the Connection

4.

Wiring of JDBC Properties

Defining the Placeholder for JDBC Type 4 Driver Class

Modify the

applicationContext.xml

file to define a placeholder for the JDBC Type 4 driver

class name

com.tandem.t4jdbc.SQLMXDriver

from the

jdbc.properties

file as shown

below.

destroy-method="close">

${jdbc.driver}

NOTE:

It is recommended that you use

com.mchange.v2.c3p0.ComboPooledDataSource

as the datasource class because it provides various parameters for connection pooling. Other
available datasource classes are

org.apache.commons.dbcp.BasicDataSource

provided

by Apache DBCP and

org.springframework.jdbc.datasource.DriverManagerDataSource

provided by

Spring framework.

Defining the Placeholder for Connection URL

Modify the

applicationContext.xml

file to define a placeholder for the connection URL

from the

jdbc.properties

file as shown below.


${jdbc.url}

Defining the Placeholder for Establishing the Connection

Modify the

applicationContext.xml

file to define a placeholder for the username and

password from the

jdbc.properties

file as shown below.


${jdbc.user}


${jdbc.password}

Wiring of JDBC Properties

After the database properties are set, wire the

jdbc.properties

file in the

applicationContext.xml

file so that the actual values are available during runtime. The

PropertyPlaceholderConfigurer

class provided by the Spring framework substitutes the

database properties specified in the

applicationContext.xml

file with the values specified

in the

jdbc.properties

file during runtime.

Modify the

applicationContext.xml

file for wiring the

jdbc.properties

file as shown

below

Spring Framework Configurations

79

This manual is related to the following products: