Executing Java External Procedures
An application is typically developed by creating a class file in Java and packaging the Java application. Another way of building application programs is to create a Java object in a database, which does not need any additional compilation or packaging processes.
This chapter explains how to create a Java application program using the created Java external procedure.
Basic Java Application Program
Development Method
Users can develop application programs in the same way as they develop a Java application program.
The following is an example.
With development of Java application programs, the following points must be noted.
Static variables cannot be accessed. This can lead to unexpected behavior.
To map a user Java class to a PSM function, users must define static class variables in the class.
Displaying Java Output
Users can check the output of Java application programs using the on screen DBMS_JAVA package. The following is an example.
For more information about the DBMS_JAVA package, refer to "Tibero tbPSM Reference Guide".
Internal JDBC Driver
Users can develop application programs using Internal JDBC Driver which resides in the Java object, as well as the JDBC interface. A Java external procedure can access the internal JDBC driver which uses the current transaction instead of using a general type of JDBC interface that makes a new connection with a database.
Connecting with a Database Server
The following example connects to a general JDBC interface.
The following example uses an internal JDBC driver.
When an existing JDBC interface is used, the Java external procedure is not included in the current transaction, but initiated as a new session. However, when an internal JDBC driver is used, the Java external program is included in the current transaction, to commit or roll back any uncompleted transactions.
After connecting the database using the internal JDBC driver, users can access the database in the same way as they do through JDBC interface.
Example
The following example creates a Java application program using an internal JDBC driver.
Last updated