I have the following code:
OracleDataSource ods = new OracleDataSource();
ods.setURL(thinConnectionString);
OracleConnection conn = (OracleConnection) ods.getConnection();
ArrayDescriptor d = ArrayDescriptor.createDescriptor("MDSYS.RDF_MODELS", conn);
When I run this code from outside Oracle's VM it works without a problem. However, when I load it on the Oracale Database JVM with loadjava tool and then run it inside Oracle, I get the following exception:
java.lang.ClassCastException
at oracle.jdbc.driver.PhysicalConnection.putDescriptor(PhysicalConnection.java)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:156)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:123)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:106)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:73)
at XercesTest.Test1(XercesTest.java:46)
at XercesTest.Test(XercesTest.java:171)
What is causing this problem and how to possibly fix it?
Edit:
When I inspect the underlying type of the connection object, I get the type oracle.jdbc.driver.T4CConnection when running outside Oracle's VM, and oracle.jdbc.driver.T2SConnection when running on the server.
Edit 2: [SOLVED]
The issue was due to conflict in the jdbc driver classes; loadjava loaded accidentally dependency files from ojdbc5.jar to the database wich caused conflit with those of Oracle. Once I dropped these, everything worked fine.