-
1. Re: ClassCastException when accessing DatabaseMetaData.getTa
azhurakousky Jul 25, 2006 7:26 PM (in response to jweaver1)What r u casting it too and can you post your code here?
Also, see what it is returning by retrieving object as java.lang.Object (which will never throw ClassCastException) and see what it is.
i.e.,Object obj = ds.getConnection().getMetaData(); System.out.println("Object class: " + obj.getClass().getName());
Regards
Oleg Zhurakousky -
2. Re: ClassCastException when accessing DatabaseMetaData.getTa
jweaver1 Jul 25, 2006 8:29 PM (in response to jweaver1)Oleg,
Thanks for responding.
The code is as follows where conn is a Connection
returned from a call to getConnection() on a Datasource from a remote server to my client application using JNDI lookup:
DatabaseMetaData dbMeta = conn.getMetaData();
...
try {
tableRes = dbMeta.getTables(null, null, null, types);
} catch (Exception e) {
System.out.println(e);
e.printStackTrace(System.err);
}
The types variable is an array of strings with values TABLE, VIEW, SYNONYM.
As you can see I do not do any casting. It is the
getTables(...) method that throws the exception.
If you would like I can expose the datasource file here.
It appears to me there is a problem with the proxy used to wrap the DatabaseMetaData and it is a problem when the datasource is to an Oracle database using the thin client driver.