Java stored procedures and Java stored functions are the stored procedures and stored functions coded in Java.
In this chapter, Java stored procedures and Java stored functions are collectively referred to as Java stored routines.
Java stored routines cannot be used in all HiRDB operation platforms. For details, see the section that describes environments in which Java stored procedures and Java stored functions can be used in the HiRDB Version 8 System Operation Guide.
Procedures for an SQL stored procedure or an SQL stored function are coded during definition. Procedures for a Java stored routine are not coded during definition; instead, the Java program registered at the server is specified. The specified Java program then functions as a stored procedure or stored function.
Figure 9-1 shows the procedure from Java stored routine creation to execution.
Figure 9-1 Procedure from Java stored routine creation to execution
- Explanation
- Code a Java stored routine. For details, see 9.2.1 Coding a Java stored routine.
- Test and debug the Java stored routine as a client AP. For details, see 9.2.1 Coding a Java stored routine.
- Register the JAR file in HiRDB. For details, see 9.2.2 Registering the JAR file in HiRDB.
- Define the Java stored routine. For details, see 9.2.3 Defining the Java stored routine.
- Execute the Java stored routine. For details, see 9.2.4 Executing the Java stored routine.
- Features of Java stored routines
- There is no overhead between the server and a client.
Java stored routines are processed at the server in the same manner as for SQL stored procedures and SQL stored functions. Therefore, there is no communication overhead between server and client.
- The procedure or function itself can be coded in Java.
Because Java is used as the programming language, more advanced control is available than SQL.
- Java stored routines are supported by different types of DBMS.
Java is a programming language independent of platform. Therefore, a program created in Java can be run in different types of DBMS that support Java stored routines.
- Debugging is easy.
To debug an SQL stored procedure or an SQL stored function, you need to execute it at the server. On the other hand, a Java stored routine can be debugged at the client, including database accesses, as long as the Java debugger is installed at the client.
- Preparations for Java stored routine execution
To execute a Java stored routine, you need to install the JDBC driver beforehand. For details about installing the JDBC driver, see 16.1 Installation and environment setup.
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.