0

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.

1 Answer 1

1

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?

Sign up to request clarification or add additional context in comments.

1 Comment

Even with DriverManager.getConnection I am getting the same error. The JDBC URL is fine, other operations execute correctly, just ArrayDescriptor giving this error. (note using jdbc5).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.