beautypg.com

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

Page 77: Wiring of jdbc properties, Configurations in the, Applicationcontext.xml, File

background image

the connection URL, specify the connection URL as

jdbc:sqlmx://

for the SQL/MX database

in the

jdbc.properties

file:

jdbc.properties file:
jdbc.url=jdbc:sqlmx://

Establishing the Connection

Specify the username and password with no values in the

jdbc.properties

file:

jdbc.username=
jdbc.password=

Configurations in the

applicationContext.xml

File

For making necessary JDBC configurations, complete the following activities:

1.

Defining the placeholder for JDBC Type 2 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 2 Driver Class

Modify the

applicationContext.xml

file to define a placeholder for the JDBC Type 2 driver

class

name com.tandem.sqlmx.SQLMXDriver

from the

jdbc.properties

file as shown

below.

destroy-method="close">

${jdbc.driver}

NOTE:

It is recommended to use

com.mchange.v2.c3p0.ComboPooledDataSource

as

the datasource class because it provides various parameters for connection pooling. In case you
do not use connection pooling, you can either use

org.apache.commons.dbcp.BasicDataSource

provided by Apache DBCP or

org.springframework.jdbc.datasource.DriverManagerDataSource

provided by

the 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

To establish the database 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 all 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

Spring Framework Configurations

77

This manual is related to the following products: