File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Getting array of Oracle Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Getting array of Oracle Objects" Watch "Getting array of Oracle Objects" New topic

Getting array of Oracle Objects

Prashanth menon
Ranch Hand

Joined: Feb 20, 2001
Posts: 65
I am using CallableStatements . The Oracle object I have is testobjtype and the package is testpkg. How do I register the outParameter of a varray type? I am getting error when I create a ArrayDescriptor ...

The code is below.

OracleCallableStatement callableStatement = (OracleCallableStatement)
con.prepareCall ("{ ? = call TESTPKG.testf(?)}");

callableStatement.setString(2, "test");

Object elements[] = new Object[20];

ArrayDescriptor desc = ArrayDescriptor.createDescriptor("TYPE_VARRAY", con);
I tried with this also
ArrayDescriptor desc = ArrayDescriptor.createDescriptor("testobjtype", con);

ARRAY newArray = new ARRAY(desc, con, elements);
callableStatement.registerOutParameter(1, OracleTypes.ARRAY, "newArray");

ResultSet rs = (ResultSet)callableStatement.getObject (1);

SQLException java.sql.SQLException: invalid name pattern: TEST.TYPE_VARRAY
java.sql.SQLException: invalid name pattern: TEST.TYPE_VARRAY
at oracle.jdbc.dbaccess.DBError.throwSqlException(
at oracle.jdbc.dbaccess.DBError.throwSqlException(
at oracle.jdbc.oracore.OracleTypeADT.initMetadata(
at oracle.jdbc.oracore.OracleTypeADT.init(
at oracle.sql.ArrayDescriptor.initPickler(
at oracle.sql.ArrayDescriptor.<init>(
at oracle.sql.ArrayDescriptor.createDescriptor(
at com.busch.wms.interfaces.TestVarray.main(
I agree. Here's the link:
subject: Getting array of Oracle Objects
It's not a secret anymore!