Neoview Guide to Stored Procedures in Java (R2.3, R2.4)

Table of Contents
About This Document.......................................................................................................13
Intended Audience................................................................................................................................13
New and Changed Information in This Edition...................................................................................13
Document Organization.......................................................................................................................13
Notation Conventions...........................................................................................................................14
General Syntax Notation.................................................................................................................14
Related Documentation........................................................................................................................16
Neoview Customer Library.............................................................................................................16
Publishing History................................................................................................................................17
HP Encourages Your Comments..........................................................................................................17
1 Introduction...................................................................................................................19
What Is an SPJ?.....................................................................................................................................19
Benefits of SPJs......................................................................................................................................19
Java Methods Callable From Neoview SQL....................................................................................20
Common Packaging Technique.......................................................................................................20
Security............................................................................................................................................20
Increased Productivity.....................................................................................................................20
Portability........................................................................................................................................21
How Do I Use SPJs in a Neoview Database?........................................................................................21
2 Getting Started.............................................................................................................23
Required Software on the Neoview Platform.......................................................................................23
Required Software on the Client Workstation......................................................................................23
Java Development Kit......................................................................................................................23
Neoview DB Admin........................................................................................................................23
Recommend Software on the Client Workstation................................................................................24
Neoview Command Interface (NCI)...............................................................................................24
Neoview JDBC Type 4 Driver..........................................................................................................24
3 Developing SPJ Methods.............................................................................................25
Guidelines for Writing SPJ Methods.....................................................................................................25
Signature of the Java Method..........................................................................................................25
Public Access and Static Modifiers............................................................................................25
Void Return Type.......................................................................................................................25
Java Parameters..........................................................................................................................25
Returning Output Values From the Java Method...........................................................................26
Using Arrays for Output Parameters.........................................................................................27
Type Mapping of Output Parameters........................................................................................27
Returning Stored Procedure Result Sets.........................................................................................27
Using the main() Method................................................................................................................29
Null Input and Output....................................................................................................................29
Static Java Variables.........................................................................................................................29
Nested Java Method Invocations.....................................................................................................29
Accessing a Neoview Database............................................................................................................29
Use of java.sql.Connection Objects..................................................................................................30
Using JDBC Method Calls...............................................................................................................30
Referring to Database Objects in an SPJ Method............................................................................31
Table of Contents 3