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

Table 3-1 Mapping of Java Data Types to SQL Data Types
Maps to SQL Data Type...Java Data Type
CHAR[ACTER]
CHAR[ACTER] VARYING
VARCHAR
PIC[TURE] X
1
NCHAR
NCHAR VARYING
NATIONAL CHAR[ACTER]
NATIONAL CHAR[ACTER] VARYING
java.lang.String
DATE
java.sql.Date
TIME
java.sql.Time
TIMESTAMP
java.sql.Timestamp
NUMERIC (including NUMERIC with a precision greater
than eighteen)
2
DEC[IMAL]
2
PIC[TURE] S9
3
java.math.BigDecimal
SMALLINT
2
short
INT[EGER]
2
int or java.lang.Integer
4
LARGEINT
2
long or java.lang.Long
4
FLOAT
double or java.lang.Double
4
REAL
float or java.lang.Float
4
DOUBLE PRECISION
double or java.lang.Double
4
None
java.sql.ResultSet[]
1 Neoview SQL stores PIC X as a CHAR data type.
2 Numeric data types of SQL parameters must be SIGNED, which is the default in Neoview SQL.
3 Neoview SQL stores PIC S9 as a DECIMAL or NUMERIC data type.
4 Choose a Java wrapper class if you plan to pass null values as arguments to or from the method. See “Null Input
and Output” (page 27).
Output parameters in the Java signature must be arrays (for example, int[] or String[]) that
accept only one value in the first element of the array at index 0. For more information, see
Returning Output Values From the Java Method.”
Returning Output Values From the Java Method
The Java method can return data to the calling application in the form of output parameters or
result sets.
Output parameters in the Java signature are parameter arrays that accept only one value in the
first element of the array at index 0. The array objects have a fixed size of one element.
IMPORTANT: You cannot return more than one value to an output parameter of an SPJ. Any
attempt to return more than one value to an output parameter results in a Java exception,
ArrayIndexOutOfBounds.
Result sets in the Java signature are one-element java.sql.ResultSet[] arrays that contain
ResultSet objects that have multiple rows of data. For more information about result sets, see
“Returning Stored Procedure Result Sets” (page 25).
24 Developing SPJ Methods