Neoview Guide to Stored Procedures in Java (R2.5)

1 Introduction
This chapter introduces stored procedures in Java (SPJs) in a Neoview database and covers these
topics:
“What Is an SPJ?”
“Benefits of SPJs” (page 17)
“How Do I Use SPJs in a Neoview Database?” (page 19)
What Is an SPJ?
A stored procedure is a type of user-defined routine (UDR) that operates within a database server
and typically performs SQL operations on a database. The database server contains information
about the stored procedure and controls its execution. A client application executes a stored
procedure by issuing an SQL CALL statement. Unlike a user-defined function, which returns a
value directly to the calling application, a stored procedure returns each output value to a dynamic
parameter in its parameter list or returns a set of values to a result set array.
Neoview SQL supports stored procedures written in the Java programming language. The
Neoview implementation of stored procedures complies mostly, unless otherwise specified, with
SQL/JRT (Java Routines and Types), which extends the ANSI SQL/Foundation standard. A stored
procedure in Java (SPJ) is a Java method contained in a Java archive (JAR) file on the Neoview
platform, registered in the Neoview database, and executed by Neoview SQL when a client
application issues a CALL statement.
The body of a stored procedure consists of a public, static Java method that returns void.
These Java methods, called SPJ methods, are contained in classes within JAR files on the Neoview
platform. Using the HP Database Manager (HPDM), you can upload a JAR file containing an
SPJ method from a client workstation to the Neoview platform and register the SPJ method as
a stored procedure in the Neoview database. An SPJ method must be registered as a stored
procedure in a Neoview database before a client application can execute it with a CALL statement.
Benefits of SPJs
SPJs provide an efficient and secure way to implement business logic in a Neoview database.
SPJs offer these advantages:
“Java Methods Callable From Neoview SQL” (page 18)
“Common Packaging Technique” (page 18)
“Security” (page 18)
“Increased Productivity” (page 18)
“Portability” (page 19)
What Is an SPJ? 17