4

Creating a DB2 Java stored procedure using IBM Data Studio, I have some libraries that are required in the classpath. I'm running Data Studio in a VM, and deploying remotely to my DB2 server in a Cloud instance.

How do I bundle up the jars with my stored procedure?

Marius Butuc
  • 17,781
  • 22
  • 77
  • 111
  • do you mean how to execute the Stored Procedure in Java application? – Luiggi Mendoza May 02 '12 at 04:36
  • I [guess](http://publib.boulder.ibm.com/infocenter/dstudio/v3r1/index.jsp?topic=%2Fcom.ibm.datatools.routines.bottomup.doc%2Ftopics%2Fcjavaspscreatedjavaprojs.html) so, then how do you deploy a Java stored procedure and it's dependencies in the Java project (_not Data project_) to be able to run the SP from DB2? – Marius Butuc May 03 '12 at 18:42
  • you need to understand 2 things: 1. Execute a stored procedure from Java Application, and 2. Create a stored procedure with Java language. You're looking [the 2nd one](http://www.redbooks.ibm.com/redbooks/pdfs/sg245945.pdf) – Luiggi Mendoza May 03 '12 at 18:53

1 Answers1

3

When deploying the stored procedure to the server:

Deploy stored procedure with Data Studio: Deploy Options

make sure you click Next instead of Finish to get to the second screen:

Deploy stored procedure with Data Studio: Routine Options

and there, in the Compile options: field append your dependencies using the -classpath command-line option.

Note: the -cp shorthand option will not work!

Community
  • 1
  • 1
Marius Butuc
  • 17,781
  • 22
  • 77
  • 111
  • I tried this and by configuring the class path it lets me deploy the store procedure. I checked the jar made and it doesn't contain the jar library, so my code fails with NoClassDefFoundError – dalcorta Apr 18 '21 at 20:43