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-3
How Do I Use SPJs?
3. Configure the SPJ environment before registering or invoking SPJs:
If you installed the NonStop Server for Java in a nonstandard location, set the
JREHOME location. See Setting the JREHOME Location on page 2-17.
If you installed the JDBC/MX driver in a nonstandard location, set the UDR
extensions class path. See Setting the JDBC/MX Location on page 2-20.
If the SPJ methods refer to application classes outside their external paths, set
those locations in the class path. See Setting the Class Path on page 2-22.
If necessary, set other JVM startup options for the SPJ environment. See
Controlling JVM Startup Options on page 2-11.
If necessary, configure Java security for the SPJ environment. See
Establishing Java Security on page 2-26.
4. As the super ID or schema owner, register each SPJ in NonStop SQL/MX by using
the CREATE PROCEDURE statement:
For details, see Section 4, Registering SPJs in NonStop SQL/MX.
5. Grant privileges to users for invoking each SPJ:
For details, see Granting Privileges for Invoking SPJs on page 6-1.
6. Invoke each SPJ by using the CALL statement:
For details, see Section 5, Invoking SPJs in NonStop SQL/MX.
CREATE PROCEDURE samdbcat.persnl.adjustsalary(IN empnum NUMERIC(4),
IN percent FLOAT,
OUT newsalary NUMERIC(8,2))
EXTERNAL NAME 'Payroll.adjustSalary'
EXTERNAL PATH '/usr/mydir/myclasses'
LANGUAGE JAVA
PARAMETER STYLE JAVA
MODIFIES SQL DATA;
GRANT EXECUTE
ON PROCEDURE samdbcat.persnl.adjustsalary
TO "HR.MGRNA", "HR.MGREU"
WITH GRANT OPTION;
GRANT SELECT, UPDATE (salary)
ON TABLE samdbcat.persnl.employee
TO "HR.MGRNA", "HR.MGREU"
WITH GRANT OPTION;
CALL samdbcat.persnl.adjustsalary(29, 2.5, ?);
NEWSALARY
------------
139400.00
--- SQL operation complete.