beautypg.com

HP Integrity NonStop J-Series User Manual

Page 114

background image

jdbc-0.proxool.alias=property
jdbc-0.proxool.driver-url=jdbc:t4sqlmx://:
jdbc-0.proxool.driver-class=com.tandem.t4jdbc.SQLMXDriver
jdbc-0.user=
jdbc-0.password=
jdbc-0.proxool.maximum-connection-count=15
jdbc-0.proxool.minimum-connection-count=5

For a list of Proxool properties, see

http://proxool.sourceforge.net/properties.html

.

Using JNDI datasource with C3P0 connection pooling

Steps to use JNDI datasource with C3P0 connection pooling are as follows:

1.

Define a bean for datasource in the applicationContext.xml file. For example:

For T2 driver:

destroy-method="close">






For T4 driver:

destroy-method="close">








2.

Register this bean as a JNDI datasource by writing a few lines of code as follows. The context
referred here is a Spring application context.

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
env.put(Context.PROVIDER_URL, "file:///home/dataSources");
Object datasource=context.getBean("T2bean"); // for T4 you can use T4Bean

try {
Context ctx = new InitialContext(env);
ctx.rebind("jndi",datasource );
}
catch (Exception e) {
}

3.

Use this JNDI datasource in a Spring Hibernate application. The applicationContext.xml
can be configured as follows:




com.sun.jndi.fscontext.RefFSContextFactory
file:///home/dataSources







jndi

Now this jndiDataSource can be set on hibernate session factory as follows:

class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

114

Hibernate Framework

This manual is related to the following products: