Stored procedures and stored functions that are coded in Java are called Java stored procedures and Java stored functions, respectively. They are referred to collectively in this chapter as external Java stored routines.
External Java stored routines cannot be used on 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 9 System Operation Guide.
The following figure shows the procedure from creation to execution of an external Java stored routine.
Figure 9-1 Procedure from creation to execution of an external Java stored routine
![[Figure]](FIGURE/ZU090010.GIF)
- Explanation
- Create an external Java stored routine. For details, see 9.2.1 Creating an external Java stored routine.
- Test and debug the Java stored routine as a client AP. For details, see 9.2.1 Creating an external Java stored routine.
- Register the JAR file in HiRDB. For details, see 9.2.2 Registering the JAR file.
- Define the external Java stored routine. For details, see 9.2.3 Defining the external Java stored routine.
- Execute the external Java stored routine. For details, see 9.2.4 Executing the external Java stored routine.
- Features of external Java stored routines
- There is no overhead for communication between the server and a client.
Because external Java stored routines are processed at the server in the same manner as SQL stored procedures and SQL stored functions, 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 with SQL.
- Java stored routines are supported by different types of DBMS.
Because Java is a platform-independent programming language, a program created in Java can be run in a variety of DBMSs that support external 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. In contrast, an external Java stored routine can be debugged at the client, including testing of database accesses, as long as the Java debugger is installed at the client.
- Preparations for external Java stored routine execution
To execute an external Java stored routine, you must have first installed the JDBC driver. For details about installing the JDBC driver, see 17.1 Installation and environment setup.
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.