Hi Dheeraj,
There could be other ways, but one that I could think of, would be to
convert the
Object[] into byte[] (using ByteArrayOutputStream and ObjectOutputStream)
in your myclass.myProcedureMethod().
the function definition will have to modified to use
RETURNS LONG VARCHAR FOR BIT DATA
Later in your java program that is invoking this function this byte[]
can be converted back into
Object[] ( using ByteArrayInputStream and ObjectInputStream )
something like:
{...
ByteArrayInputStream bio=new ByteArrayInputStream(rs.getBytes(1));
ObjectInputStream oi=new ObjectInputStream(bio);
Object [] obj=new Object[32];
obj=(Object [])oi.readObject();
...
}
Some other useful information on functions and procedures:
http://wiki.apache.org/db-derby/DerbySQLroutines
Hope this helps. Do post to the list, should you have any further questions.
-Rajesh
Dheeraj Dhiman wrote:
I m using apache derby for my Project !!
In this project we want to make a function
which accecpt three long argument & i want to return Object[] ( Object
Array ) !!
Can this is possible in apache derby if yes then pls give example !!
My Case is :::
create function myprocedure( id1 bigint , id2 bigint , id3 bigint )
returns Object[] parameter style java reads sql data language java
external name 'myclass.myProcedureMethod' ;
class myclass{
public static Object[] myProcedureMethod(long id1 , long id2 , long id3){
return new Object[32];
}
}
Thanks !!