The three methods are:
.-,--------------------. V | (1) >>-jdbc--:--db2--:--subsystem--:--pdqProperties--=----+-key-- -value-----+-+--;----->< '-key--(--value--)-'
.-,--------------------. V | (1) >>-jdbc--:--db2--:--//--server--+---------+--/--database-or-subsystem--:--pdqProperties--=----+-key-- -value-----+-+--;----->< '-:--port-' '-key--(--value--)-'
java.util.Properties myPdqProperties = new java.util.Properties(); myPdqProperties.put("pdq.captureMode","ON");
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 ();
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);
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();