I've seen only a few postings on this topic, none of which were answered. So I am thinking perhaps a detailed explanation is required? Or is it just too simple to be beyond boring? I need professional help in any event.
I have an applet users employ to create a table of values. The data model for the table is, ultimately, a Vector, each element of which is itself a Vector with the following fields (all of which are Strings): symbol, label, description, colour, numpar, parent, parsing, objectid. So, I have a Vector of any length comprised of Vectors of length 8.
On pressing the "SAVE" button I wish the Vector of Vectors to be sent to my Oracle database. To receive the data I created these types in Oracle:
TYPE LegendItem IS OBJECT(symbol VARCHAR2(50),
label VARCHAR2(50),
descrip VARCHAR2(255),
colour VARCHAR2(20),
numpar VARCHAR2(10),
parent VARCHAR2(10),
parsing VARCHAR2(625),
objectid VARCHAR2(10));
TYPE AppletVector IS TABLE OF LegendItem INDEX BY BINARY_INTEGER;
The stored procedure that takes the data and uses it to update (about 25) tables in the schema is defined as
PROCEDURE loadLegend (legendata IN AppletVector,
schemeid IN INTEGER,
sourceid IN INTEGER,
message OUT VARCHAR2)
(Message is returned as "success" if there are no exceptions, or the exception parameters if they exist.)
I am trying
Class.forName ("oracle.jdbc.driver.OracleDriver");
Connection conx_out = DriverManager.getConnection ("jdbc:oracle:thin:@myserveraddress","username", "password");
CallableStatement feedOra = conx_out.prepareCall("{ call newLegendData.loadLegend(?,?,?,?) }");
ArrayDescriptor arrDesc = ArrayDescriptor.createDescriptor("AppletVector", conx_out);
feedOra.setArray(1, new ARRAY(arrDesc, conx_out, legendModel.getDataVector().toArray()));
feedOra.setString(2, MakeLegend.mapScheme);
feedOra.setString(3, MakeLegend.mapSource);
feedOra.registerOutParameter(4, Types.VARCHAR);
feedOra.execute();
which returns
setArray(int,java.sql.Array) in java.sql.PreparedStatement cannot be applied to (int,oracle.sql.ARRAY)
feedOra.setArray(1, new ARRAY(arrDesc, conx_out, legendModel.getDataVector().toArray()));
^
cannot resolve symbol
symbol : method setString (int,int)
location: interface java.sql.CallableStatement
feedOra.setString(2, MakeLegend.mapScheme);
^
cannot resolve symbol
symbol : method setString (int,int)
location: interface java.sql.CallableStatement
feedOra.setString(3, MakeLegend.mapSource);
Is this the way to approach the problem? Should I use a different method? How do I make java.sql.Array == oracle.sql.ARRAY?
Your suggestions are gratefully received.