Undocumented properties in DB2 JDBC Driver
IBM has listed the properties that can be modified at runtime for the JDBC type IV driver v8. I decided to see what other properties were lurking in the classes that were undocumented. Some of these seem self-explanatory, but some would require some digging. I would take the time to go through them all but IBM has obfuscated their drivers... the non-JDBC interfaces and method signatures are painful to trace. It will be a while before I try to really figure out what a.a().a().a(a,o,xz,y) means.
| Name | Type | Default | Possible Values | Transient |
| clientApplicationInformation | String | null | no | |
| clientProgramId | String | null | no | |
| clientRerouteServerListJNDIName | String | null | no | |
| currentLockTimeout | int | LOCK_TIMEOUT_NOT_SET | LOCK_TIMEOUT_NO_WAIT(0) LOCK_TIMEOUT_WAIT_INDEFINITELY (-1) LOCK_TIMEOUT_NOT_SET(Integer.MIN_VALUE+1) | no |
| currentQueryOptimization | int | QUERY_OPTIMIZATION_NOT_SET | QUERY_OPTIMIZATION_NOT_SET(Integer.MIN_VALUE+1) | no |
| dataSourceName | String | null | no | |
| dateTimeMutation | boolean | false | true false | yes |
| maxRetriesForClientReroute | int | MAX_RETRIES_NOT_SET | MAX_RETRIES_NOT_SET(-1) | yes |
| maxTransportObjects | int | MAX_TRANSPORT_OBJECTS | MAX_TRANSPORT_OBJECTS(Integer.MAX_VALUE) | yes |
| queryCloseImplicit | int | QUERY_CLOSE_IMPLICIT_YES | QUERY_CLOSE_IMPLICIT_YES(1) QUERY_CLOSE_IMPLICIT_NO(2) | yes |
| retryIntervalForClientReroute | int | RETRY_INTERVAL_NOT_SET | RETRY_INTERVAL_NOT_SET(-1) | yes |
| returnAlias | short | 1 | no | |
| sysSchema | string | null | no | |
| useCachedCursor | boolean | true | true false | no |
| useTransactionRedirect | boolean | false | true false | no |
The thing you have to watch out for is the transient stuff. If you use a DataSource that could possibly be serialized, you will be SOL if it is. So using the transient properties in an appserver with a pool, might come back to bite you.

DataSource properties
Hi ,
I need to use one of the properties of DataSource described above namely clientRerouteServerListJNDIName, but my datasource class has no such methods in it .please let me what needs to be done for getting all the latest methods .I included latest db2jcc.jar file still was not able to find.
Thanks,
Jim
Re: DataSource properties
Not trying to be flip but how do you know the datasource in the jar doesn't have the methods on it? Did you cast down to the IBM datasource? If not, you will need to do that to see these methods (if they exist on the datasource at all).
Remember, that these are undocumented properties that I found inside the classes. I don't remember if they are all exposed through the DataSource implementation. It wouldn't suprise me if the only way to set these properties is via the Properties object in a DriverManager obtained connection.
It looks like this property was exposed in UDB version 8.2 though.
-Matt
Thanks for the reply, but my
Thanks for the reply, but my problem is still not solved
Here is the sample code
if(dataSource == null)
{
try
{
// Create a starting context for naming operations
InitialContext registry = new InitialContext();
dataSource = (DataSource) registry.lookup(DATASOURCE_NAME);
if(dataSource == null)
{
throw new ServletException("`" + DATASOURCE_NAME +
"' is an unknown DataSource");
}
// Create a DB2ClientRerouteServerList object
DB2ClientRerouteServerList address = new DB2ClientRerouteServerList();
// Set the port number and server name for the primary server
address.setPrimaryPortNumber(50004);
address.setPrimaryServerName("primary server");
// Set the port number and server name for the alternate server
int[] port = { 50020 };
String[] server = {"secondary server"};
address.setAlternatePortNumber(port);
address.setAlternateServerName(server);
registry.rebind("serverList", address);
dataSource.setClientRerouteServerListJNDIName("serverList");
}
catch(NamingException e)
{
throw new ServletException(e);
}
}
Here when we are setting the ClientRerouteServerListJNDIName into the datasource object , it is giving error.
The abstract public interface javax.sql.Datasource extends java.lang.object and only has Logwriter and LogTimeout as its setter methods.It doesn't show any ClientRerouteServerListJNDIName.
Please help me out.
Thanks in advance ,
Jim
Classcast Exception
I got java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
when I tried
dataSource = (DB2DataSource) registry.lookup(DATASOURCE_NAME);
instead of
dataSource = (DataSource) registry.lookup(DATASOURCE_NAME);
in the above code .
Can any one help me out ?
Try this out
Since you are using WAS, you don't really control what comes back from JNDI.. try this out:
import com.ibm.ws.rsadapter.jdbc.WSJdbcConnection; import com.ibm.ws.rsadapter.jdbc.WSJdbcUtil; ... if (con instanceof WSJdbcConnection) { dataSource = (DB2DataSource) WSJdbcUtil.getNativeConnection((WSJdbcConnection) con); }Obviously this is IBM specific but the rest of what you are trying to do (setClientRerouteServerListJNDIName) is as well.
hth,
Matt