Setting the classpath of the JVM for OC4J
Is there any way to add a path to the classpath when the embedded OC4J is run? Although the OC4J is finding my classes, the Oracle JDBC driver isn't. Here's a bit more info:
I've been having a bit of a problem getting database java objects ("CREATE TYPE...EXTERNAL NAME...LANGUAGE JAVA USING SQLData") instantiated on the client.
- I have an object table of type t_my_type with Java class "mypackage.MyType".
Code sample:
------------------------------
ResultSet rs = myStatement.executeQuery(
"SELECT VALUE(p) FROM my_type_table p" );
rs.next();
rs.getObject( 1 );
------------------------------
Exception in thread "main" java.sql.SQLException:
Inconsistent java and sql object types:
ClassNotFoundException: mypackage.MyType
at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
at
oracle.sql.JAVA_STRUCT.toJdbc(JAVA_STRUCT.java:108)
... ad nauseum
------------------------------
And yet when I add "-classpath /path/to/mypackage" it works fine. HOWEVER, I don't know how to add it to the OC4J startup classpath (marked "HERE" below? -- not application.xml, the one that you see in the "Log" window in jDeveloper):
java \
-server \
-Xdebug \
... \
-classpath /path/to/oc4j/oc4j.jar:<HERE> \
...
Incidentally, I'm also interested in having the Database send me the bytecode for the class ITSELF instead of having to also have a copy of the .class/.jar on the client side as well.
Any help would be appreciated. Thanks.