Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using oracle.java.array

Status
Not open for further replies.

kondakindi

IS-IT--Management
Apr 18, 2005
31
US
Hi,
I Have created a normal table in oracle and a arraytype xx-type of varchar2(255) in oracle..
I have wriiten a procedure in to insert values into the table in oracle using the array type.
In java when i call that procedure and create a orcale.sql.array type and give the connection and descriptor and oracle.sql.array type it gives thet following error:

Error :
setArray(int,java.sql.Array) in java.sql.PreparedStatement
cannot be applied to (int,oracle.sql.ARRAY)
cstms.setArray (2, colValue);

The follwoing is the code..


CallableStatement cstms=null;
String procedureCall = "{call INSERT_BASE_SURVEY(?,?,?,?, ?, ?)}";

cstms = insert_oracleKonnection.getCon().prepareCall(procedureCall);

ArrayDescriptor in_arr = new ArrayDescriptor("SURVEY_ARRAY",insert_oracleKonnection.getCon());

oracle.sql.ARRAY colName = new oracle.sql.ARRAY(in_arr,insert_oracleKonnection.getCon(),columnName);
oracle.sql.ARRAY colValue = new oracle.sql.ARRAY(in_arr,insert_oracleKonnection.getCon(),columnValue);

cstms.setArray (1, colName );
cstms.setArray (2, colValue);
cstms.setString (3, APP_NAME);
cstms.setString (4, httpSessionID);
cstms.setString (5, inucid);
cstms.registerOutParameter(6, java.sql.Types.VARCHAR);
cstms.executeQuery();

Do i have to set up a path for this i have set the path for classes111.zip and classes12.zip
Do let me know what is my error.
Thanks,
 
I don't know what a oracle.sql.ARRAY is, but java.sql.PreparedStatement is expecting a java.util.Array object in its setArray method.

Make sure you have the definition of the Oracle classes in your classpath.

Other possible solution could be doing a cast to the Array type.

Cheers,

Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top