Reputation: 4178
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.
Upvotes: 0
Views: 694
Reputation: 12998
Where does the OracleDataSource and OracleConnection classes come from? Have you tried to get the connection just by using "standard JDBC classes"?
Connection conn = DriverManager.getConnection("jdbc:default:connection")
It seems that your data source connection is not that what the Oracle driver expects.
Have you changed the JDBC URL accordingly?
Do other operations fail as well, or is it just the ArrayDescriptor?
Upvotes: 1