SQL/MX Guide to Stored Procedures in Java (G06.24+, H06.03+)

Introduction
HP NonStop SQL/MX Guide to Stored Procedures in Java523727-004
1-5
Common Packaging Technique
Common Packaging Technique
Different applications can invoke the same SPJ to perform a common business
function. By encapsulating business logic in an SPJ, you can maintain consistent
database operations and avoid duplicating code in applications.
Applications that call SPJs are not required to know the structure of the tables that the
SPJ methods access. If the table structure changes, you must change the SPJ
methods but not necessarily the CALL statements within each application.
Security
By using SPJs, you can conceal sensitive business logic inside SPJ methods instead
of exposing it in client applications. You can also grant privileges to execute an SPJ to
specific users and restrict the privileges of other users. For more information, see
Granting Privileges for Invoking SPJs on page 6-1.
Increased Productivity
Use SPJs to reduce the time and cost of developing and maintaining SQL/MX
applications. By having several applications call the same SPJ, you need only change
the SPJ method once when business rules or table structures change instead of
changing every application that calls the SPJ.
Using the Java language to implement stored procedures increases development
productivity. Given the popularity of the Java language, you can leverage the existing
skill set of Java programmers to develop SPJs. The portability of the Java language
enables you to write and compile Java class files for SPJs once and deploy them
anywhere.
Portability
Because SPJ methods are written in Java, and SPJs conform to the ANSI SQL
standard, SPJs are portable across different database servers. With minimal changes
to SPJ methods, you can port existing Java classes from another database server to a
NonStop server and register the methods as SPJs in NonStop SQL/MX. You can also
port existing applications that call SPJs from other databases to NonStop SQL/MX with
minimal changes to the CALL statements in the application.
Note. NonStop SQL/MX does not support stored procedure result sets, which might prevent
some SPJs from being ported to NonStop SQL/MX.