Java procedures in DB2 are not known for their performance. Please
consider using another language (SQL, C) if all this procedure is going
to do is execute some SQL based on somewhat trivial processing.
In my experience, the valid uses for JAVA routines are:
1) Complex operations that are difficult in other languages (accessing
non-text file resources)
2) Anything involving inheritance from a base wrapper class (of course)
Consider that JAVA routines always run in FENCED mode -- this is always
true in V8 even if it is cataloged as NOT FENCED due to issues with
hosting the JVM inside an agent -- and execute dynamic SQL statements.
Both are a significant performance hit.
My experience has been that LANGUAGE JAVA should only be used as a last
resort when no other language will do. JAVA itself is a nice language,
but it's not efficient to use it as an everyday procedure language in DB2.
Viator wrote:
Hi All;
I am working on project; where I need to call a DB2 stored procedure
(also to be written in the project) which will update/insert some
records in the database. The number of rows to be intserted are decide
at runtime and there is a constraint that the procedure should be
called only once.
So the questino is...
Can we pass a java array or a Collection using JDBC to DB2? If yes how
can we read that array in the DB2 stored procedure? We are using DB2
Connect to connect to DB2 server.
Thanks And Regards,
Viator