|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Pass Array/Table Oracle type using JDBC Configurable Service |
« View previous topic :: View next topic » |
Author |
Message
|
talalanwar |
Posted: Fri Jul 04, 2014 1:44 pm Post subject: Pass Array/Table Oracle type using JDBC Configurable Service |
|
|
Newbie
Joined: 26 Jan 2013 Posts: 7
|
I have Oracle procedures that takes input a user-defined Type. UDT is an array of Object(Another UDT). Below are the Type declarations.
Code: |
create or replace Type R_OpenCloseRecords as Object(VSerial_No number, VError_Code varchar2(2), VReason varchar2(255), VStatus char(1));
create or replace Type T_OpenCloseType as varray(100) of R_OpenCloseRecords ;
procedure UpdateOpenCloseRecord(VOpenCloseType in T_OpenCloseType); |
I have also tried the above with table of records.
I have tried the above scenario with java oracle types ArrayDescriptor and StructDescriptor. But it returns with this exception: oracle.jdbc.driver.LogicalConnection incompatible with oracle.jdbc.OracleConnection
If i use java.sql.Struct it works fine for Object type, but the createArrayOf method fails with exception: Unsupported Feature.
Below is my java code snippet:
Code: |
callableStatement = connection.prepareCall("{call " + schemaPackageName + ".UpdateOpenCloseRecord(?)}");
//callableStatement.registerOutParameter(1, Types.OTHER);
callableStatement.setQueryTimeout(timeOut);
// StructDescriptor R_OpenCloseRecords = StructDescriptor.createDescriptor("R_OpenCloseRecords", connection);
// Object[] arrayObjectRecord = { data.getSerialNo(), data.getErrorCode(), data.getReason(), data.getStatus() };
// STRUCT RecordStruct = new STRUCT(R_OpenCloseRecords, connection, arrayObjectRecord );
Object[] arrayObjectRecord = { Integer.parseInt(data.getSerialNo()), data.getErrorCode(), data.getReason(), data.getStatus() };
Struct recordStruct = connection.createStruct((schemaName+ ".R_OpenCloseRecords").toUpperCase(), arrayObjectRecord);
// STRUCT[] arrayObjectTable = {RecordStruct};
// ArrayDescriptor T_OpenCloseType = ArrayDescriptor.createDescriptor(
// schemaPackageName+ ".T_OpenCloseType", connection);
// VOpenCloseArray = new ARRAY(T_OpenCloseType, connection, arrayObjectTable);
Object[] arrayObjectTable = {recordStruct};
callableStatement.setObject(1,connection.createArrayOf((schemaName+ ".T_OpenCloseType").toUpperCase(), arrayObjectTable) );
//callableStatement.setObject(1, arrayObjectTable, Types.ARRAY);
//callableStatement.setArray(1,VOpenCloseArray);
callableStatement.execute(); |
You may see the use of descriptors in comments. Connection is acquired using getJDBCType4Connection of MbJavaComputeNode.
Awaiting your reply. |
|
Back to top |
|
 |
talalanwar |
Posted: Sat Jul 05, 2014 9:04 am Post subject: |
|
|
Newbie
Joined: 26 Jan 2013 Posts: 7
|
Issue is resolved by externally referencing the ojdbc jar which actually doesn't include the jar within the bar file |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|