Setting properties locally for individual connections

You can use any of three methods to set these properties for individual connections.

For DB2® and Informix® Dynamic Server data sources

The three methods are:

Adding the pdqProperties string to a URL in a Connection object
For Type 2 URLs, add the pdqProperties string as in this syntax diagram:
Read syntax diagramSkip visual syntax diagram
                                                    .-,--------------------.          
                                                    V                      |    (1)   
>>-jdbc--:--db2--:--subsystem--:--pdqProperties--=----+-key-- -value-----+-+--;-----><
                                                      '-key--(--value--)-'            

Notes:
  1. You can specify other properties for the IBM® Data Server Driver for JDBC and SQLJ besides pdqProperties. Separate each, including its values, with a semicolon.
For Type 4 URLs, add the pdqProperties string as in this syntax diagram:
Read syntax diagramSkip visual syntax diagram
                                                                                            .-,--------------------.          
                                                                                            V                      |    (1)   
>>-jdbc--:--db2--:--//--server--+---------+--/--database-or-subsystem--:--pdqProperties--=----+-key-- -value-----+-+--;-----><
                                '-:--port-'                                                   '-key--(--value--)-'            

Notes:
  1. You can specify other properties for the IBM Data Server Driver for JDBC and SQLJ besides pdqProperties. Separate each, including its values, with a semicolon.
Setting the properties in a Properties object that you pass to the Connection
When you set the properties, prefix them with pdq, as in this example:
java.util.Properties myPdqProperties = new java.util.Properties();  
myPdqProperties.put("pdq.captureMode","ON");
Setting the properties in a DataSource object
You can set them as in this example:
DB2SimpleDataSource dbsrc = new DB2SimpleDataSource ();
dbsrc.setServerName ("serv1.jke.com");
dbsrc.setDatabaseName ("STLEC1");
dbsrc.setPortNumber (446);
dbsrc.setUser ("sysadm");
dbsrc.setPassword ("passw0rd");
dbsrc.setDriverType (4);
dbsrc.setPdqProperties("captureMode(on),pureQueryXml(Sample22.xml)");
Connection con = dbsrc.getConnection (); 

For Oracle data sources

You can set the properties in a DataSource object. There are four different types of DataSource object that you can use.

All four DataSource objects implement this method:

public void setPdqProperties(String properties);
com.ibm.pdq.runtime.datasource.datadirect.EnhancedDataSourceForOracle
This object wraps com.ddtek.jdbcx.oracle.OracleDataSource, which is a DataDirect DataSource object. To use this object, you must connect to an Oracle database by using DataDirect Connect for JDBC, Version 4.0.
com.ibm.pdq.runtime.datasource.oracle.EnhancedDataSourceForOracle
This object extends oracle.jdbc.pool.OracleDatasource. To use this object, you must connect to an Oracle database by using one of the Oracle drivers that are listed below.
com.ibm.pdq.runtime.datasource.oracle.EnhancedConnectionPoolDatasourceForOracle
This object extends oracle.jdbc.pool.OracleConnectionPoolDataSource. To use this object, you must connect to an Oracle database by using one of the Oracle drivers that are listed below.
com.ibm.pdq.runtime.datasource.oracle.EnhancedXADataSourceForOracle
This object extends oracle.jdbc.xa.client.OracleXADataSource. To use this object, you must connect to an Oracle database by using one of the Oracle drivers that are listed below.

To use any of the DataSource objects that extend objects from Oracle, you must connect to an Oracle database by using one of these drivers:

All of these objects implement the public methods that are in the original objects from DataDirect and Oracle.

For example, code that sets properties on an OracleConnectionPoolDataSource object might look like this:

OracleConnectionPoolDataSource ocpds = new OracleConnectionPoolDataSource();

ocpds.setDriverType("oci8");
ocpds.setServerName("dlsun999");
ocpds.setNetworkProtocol("tcp");
ocpds.setDatabaseName("816");
ocpds.setPortNumber(1521);
ocpds.setUser("scott"); 
ocpds.setPassword("tiger");

PooledConnection pc = ocpds.getPooledConnection();

Connection conn = pc.getConnection();

This code example shows how you can set properties on a EnhancedConnectionPoolDatasourceForOracle object:

EnhancedConnectionPoolDatasourceForOracle ecpdfo = new EnhancedConnectionPoolDatasourceForOracle();

ecpdfo.setDriverType("oci8");
ecpdfo.setServerName("dlsun999");
ecpdfo.setNetworkProtocol("tcp");
ecpdfo.setDatabaseName("816");
ecpdfo.setPortNumber(1521);
ecpdfo.setUser("scott"); 
ecpdfo.setPassword("tiger");
ecpdfo.setPdqProperties("captureMode(on),pureQueryXml(Sample22.xml)");

PooledConnection pc = ecpdfo.getPooledConnection();

Connection conn = pc.getConnection();

Feedback