Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Setting the classpath of the JVM for OC4J

424993Jul 8 2004
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 5 2004
Added on Jul 8 2004
0 comments
198 views