Neoview JDBC Type 4 Driver API Reference (R2.2, R2.3, R2.4, R2.5)

Package Class Tree Deprecated Index Help
PREV CLASS NEXT CLASS FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
com.hp.t4jdbc
Class HPT4DataSource
java.lang.Object
com.hp.t4jdbc.T4Properties
com.hp.t4jdbc.T4DSProperties
com.hp.t4jdbc.HPT4DataSource
All Implemented Interfaces:
javax.sql.DataSource, javax.naming.Referenceable, java.io.Serializable
public class HPT4DataSource
extends T4DSProperties
implements javax.sql.DataSource, java.io.Serializable, javax.naming.Referenceable
HP JDBC Type 4 Driver DataSource class.
Description: A DataSource object is a factory for Connection objects. An object that implements the DataSource
interface is typically registered with a JNDI service provider. A JDBC driver that is accessed through the DataSource
API does not automatically register itself with the DriverManager object.
The HPT4DataSource class can provide connection pooling and statement pooling features.
Setting properties for the HPT4DataSource in the Type 4 driver
HPT4DataSource ds = new HPT4DataSource();
ds.setUrl("jdbc:hpt4jdbc://:/:");
ds.setCatalog("your catalog");
ds.setSchema("your schema");
ds.setUser("user name");
ds.setPassword("user password");
// Following are optional properties
ds.setConnectionTimeout("timeout in seconds");
ds.setT4LogFile("your log file location");
ds.setT4LogLevel("SEVERE");
ds.setServerDataSource("NDCS datasource name");
// Properties relevant for Type 4 connection pooling.
// Set ds.setMaxPoolSize(-1) to turn OFF connection pooling
ds.setMaxPoolSize("number of connections required");
ds.setMinPoolSize("number of connections required");
// Properties relevant for Type 4 statement pooling.
// Set ds.setMaxStatement(0) to turn statement pooling OFF
// Statement pooling is enabled only when connection pooling is enabled.
ds.setMaxStatements("number of statements to be pooled");
Programmatically registering HPT4DataSource with JDNI
java.util.Hashtable env = new java.util.Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "Factory class name here");
javax.naming.Context ctx = new javax.naming.InitialContext(env);
ctx.rebind("DataSource name here", ds);
Application making Type4 connection using the DataSource from JDNI
java.util.Hashtable env = new java.util.Hashtable();