If a stored procedure has parameters, you can generate
a bean that represents those parameters. If the stored procedure returns
result sets, you can generate a bean for each result set. You can
also generate code in support of the annotated-method and inline programming
styles.
Before you begin
- In the Package Explorer, create a Java project or use an existing
one.
- In the Data Source Explorer, create a connection
to the database that contains the stored procedure that you want to
use. If the Data Source Explorer does not currently
appear in the workbench, select . In the Show View window, select .
About this task
If you want to use the annotated-method
programming style, you can choose to generate the following Java objects:
If you want to use the inline programming
style, you can choose to generate a test class that contains the inline
method for calling the stored procedure that the generated beans are
based on. When you run the class, the results are displayed in the Console view.
Procedure
To generate pureQuery code from a stored procedure:
- In the Data Source Explorer, right-click the stored procedure
that you want and select . The Generate pureQuery Code from a Stored Procedure wizard
opens.
- Complete the wizard steps. For detailed information
about each field, press F1.
- Click Finish to generate the files
that you specified.
Results
If you did not already add pureQuery support to your Java project, after you click Finish the
workbench creates the folder dataAccessFolder in your Java project.
If
you are using DB2® for z/OS®, or DB2 for Linux, UNIX, or Windows, this folder contains the files Default.genProps and Default.bindProps.
You use these files if you plan to run SQL statements statically from
applications that use annotated methods.