This is a discussion on Passing a java array in to a DB2 stored procedure within the DB2 forums, part of the Database Server Software category; --> Hi All, I am having a hard time figuring out how to pass a ("true") java array, like int[], ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi All, I am having a hard time figuring out how to pass a ("true") java array, like int[], from a jdbc application in to a DB2 stored procedure or UDF (can be a java or SQL proc or a table UDF). Having the application to write the array to a DB2 global temp table, or passing it in any surrogate form like delimited string (or a byte stream) of elements, are not possible alternatives. Is that implementable at all with DB2 jdbc? (I am using DB2 UDB 8.1.4 for Linux) Thanks, -Eugene |
| |||
| Eugene, I don't think there is an alternative, although I'm no JDBC expert. Can you elaborate on why a temp table is not an option? Cheers Serge -- Serge Rielau DB2 SQL Compiler Development IBM Toronto Lab |
| |||
| Serge Rielau <srielau@ca.eye-be-em.com> wrote in message news:<c08h5a$2pv$1@hanover.torolab.ibm.com>... > Eugene, > > I don't think there is an alternative, although I'm no JDBC expert. > Can you elaborate on why a temp table is not an option? > > Cheers > Serge Hi Serge, Yes... finaly we adjusted the java app to utilize temp tables as a workaround. But the goal was to minimize volume of calls to the database from the client via jdbc and taking advantages of stored procs as much as possible. Regards, -Eugene |
| |||
| Eugene, If you want to minimize calls to DB2 then here is a thought: Can you use a normal Java function invocation in these cases and push the JDBC horizon down further? Cheers Serge -- Serge Rielau DB2 SQL Compiler Development IBM Toronto Lab |
| |||
| Serge, Can you please clarify your point, an example would be ideal. Thanks, -Eugene "Serge Rielau" <srielau@ca.eye-be-em.com> wrote in message news:c0aq69$ous$1@hanover.torolab.ibm.com... > Eugene, > > If you want to minimize calls to DB2 then here is a thought: > Can you use a normal Java function invocation in these cases and push > the JDBC horizon down further? > > Cheers > Serge > -- > Serge Rielau > DB2 SQL Compiler Development > IBM Toronto Lab |
| ||||
| If I knew Java.....let me try C Insetad of CREATE PROCEDURE p1(IN arg ARRAY[10]) BEGIN ... LOOP through arg... INSERT ..... END LOOP END App: EXEC SQL CALL p1(array); use void p1(array *arg) { for (i = 0, i < 10, i++) { val = arg[i]; EXEC SQL INSERT .....; } } App: .... p1(arg); .... -- Serge Rielau DB2 SQL Compiler Development IBM Toronto Lab |