Product Documentation
Abstract
Steps to create and deploy a Java Stored procedure in IBM Data Studio
Content
- From the Db2 11 for z/OS Program Directory: Applications or stored procedures written in Java, such as those using the JDBC or SQLJ interfaces to Db2, require the IBM 31-bit SDK for z/OS, Java 2 Technology Edition V5 (5655-N98), or later, at run time.
- From the Db2 12 for z/OS Program Directory: Applications or stored procedures written in Java, such as those using the JDBC or SQLJ interfaces to Db2, require IBM 31-bit SDK for z/OS, Java Technology Edition, V6 (SDK6) (5655-R31), or later, at run time. Optionally, the following may be used for applications written in Java:
- IBM 64-Bit SDK for z/OS, Java Technology Edition, V6 (SDK6) (5655-R32), or later, at run time.
- Note: PIDs 5655-R31 and 5655-R32 are independent products and can coexist on the same z/OS system.
- Go to the Data Project Explorer panel, select Stored Procedures, and right-click and select New -> Stored Procedure.
- In the New Stored Procedure panel, select the language as “Java”(by default, it is set to SQL).
- Select the template according to the description as per the requirement for your Java Stored Procedure and click Finish.
- A Java stored procedure named Procedure3 is created in the workspace.
- Edit the .java file and save.
- In the Data Project Explorer, select Stored Procedures, right-click and select Deploy... to build this stored procedure on the target database.
- Select the stored procedure to be deployed and click Next.
- The Deploy Routines wizard opens.
Ensure that the Use current database radio button is selected in the Target database frame.
If you want to deploy this routine on a different database from the one your database development project was bound to when it was created, select the Use different database radio button and use the Database drop-down list to select a database where this stored procedure should be built.
You can use the Schema field in the Target schema for deploying an unqualified routine box to specify the schema for the stored procedure.
Select the Treat duplicates as errors radio button in the Duplicate handling box.
You can tell IBM Data Studio what to do when you try to deploy a stored procedure on a database where a stored procedure with the same name within the same schema already exists. If you select the Drop duplicates radio button, IBM Data Studio will drop the existing stored procedure and create a new one with the same name using the Java code in your project.
You can deploy multiple stored procedures in a single deployment using IBM Data Studio as well. If you select the Ignore duplicates and continue to the next routine radio button, IBM Data Studio will simply skip any stored procedures with the same name and build those that are unique on the target database.
Select the Deploy by building the source radio button to do a full build of the stored procedure. Deploy the Java source and the binaries to the database. Now click Next.
- In the Deploy Routines window, some fields in the Routine options and Deploy options tabs are selected by default but can be changed.
- On the Routines Options page, in the Deploy options tab select the Build Utility if needed.
Select the Enable debugging check box so you can leverage the distributed debugging capabilities that are part of IBM Data Studio. Click Finish.
- Check the SQL Results tab to see the deployment status.
- In Db2 for z/OS, you can customize options such as the WLM environment, ASU time limit, deployment options, and adding a java path.
- In Db2 for LUW, the Deploy Routines window has only the following captured options:

Document Location
Worldwide
Was this topic helpful?
Document Information
More support for:
IBM Data Studio
Software version:
All versions
Operating system(s):
Windows
Document number:
884548
Modified date:
09 January 2024
UID
ibm10884548