aspose file tools*
The moose likes JDBC 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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Getting array of Oracle Objects" Watch "Getting array of Oracle Objects" New topic
Author

Getting array of Oracle Objects

Prashanth menon
Ranch Hand

Joined: Feb 20, 2001
Posts: 65
Hi
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");
callableStatement.execute();

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

ERROR:
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(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.oracore.OracleTypeADT.initMetadata(OracleTypeADT.java:424)
at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java:343)
at oracle.sql.ArrayDescriptor.initPickler(ArrayDescriptor.java:1002)
at oracle.sql.ArrayDescriptor.<init>(ArrayDescriptor.java:132)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:97)
at com.busch.wms.interfaces.TestVarray.main(TestVarray.java:75)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting array of Oracle Objects