The following describes how to call the DB2 Stored Procedure method through Lotus Notes to call the DB2 stored procedure. If you are interested in the DB2 stored procedure, take a look.
Compiling DB2 stored procedures and calling DB2 stored procedures in Lotus Notes
Applications that use DB2 stored procedures must be written into two independent processes. The main program is included in the customer application and executed on the client. The main program can be written in any supported host language. The stored procedure is executed on the database server and must be written in a programming language that supports the database server.
We can use Java to write proxies or DECS, NotesPump real-time Notes jobs to call stored procedures, such as COBOL, REXX, or Java.
Lotus Notes calls the DB2 Stored Procedure
We use the ExecProcedure method to call the Stored Procedure named testProce. First, you must catalog the stored PROCEDURE in the database that runs the stored PROCEDURE, which uses the create procedure SQL statement. Up to 30 parameters can be transferred to the stored procedure, which is a limitation of Lotus script ). These parameters are used for input or output, or both input and output, depending on the parameter definition when the stored procedure is catalogued.
The client program, such as the LoadEmployee proxy, runs on the client and performs the following actions:
1. Declare, allocate, and initialize buckets for optional data structures and host variables:
[Code: 1: 3f6f8a2cde] Dim SalaryMedian As Long
Dim WorkDept As String
Where:
SalaryMedian host variable
WorkDept host variable [/code: 1: 3f6f8a2cde]
2. Connect to the database:
[Code: 1: 3f6f8a2cde] retcode % = Con. ConnectTo ("DEMO", "db2admin", "db2admin ")
Where:
ODBC name for accessing DB2 created in DEMO
Db2admin OS/400 user profile
Db2admin Login password [/code: 1: 3f6f8a2cde]
3. ExecProcedure to call the stored procedure:
[Code: 1: 3f6f8a2cde] rc = res. ExecProcedure ("testProce", SalaryMedian, workdept)
Where:
Registration Name of the testProcedure Stored Procedure
SalaryMedian is an output variable that receives the value passed by the stored procedure.
An output parameter of the WorkDept stored procedure [/code: 1: 3f6f8a2cde]
4. receive data from the stored procedure:
[Code: 1: 3f6f8a2cde] doc. SalaryMedian = SalaryMedian [/code: 1: 3f6f8a2cde]
5. Disconnect the connection to the same database and implicitly execute the following commit:
[Code: 1: 3f6f8a2cde] If Not Res Is Nothing Then Res. Close (DB_CLOSE)
If Not Con Is Nothing Then Con. Disconnect [/code: 1: 3f6f8a2cde]
DB2 exception Processor type
DB2 connection Server Configuration
Learn about the DB2 lock types
Deep Analysis of DB2 Lock Mechanism
Implementation of adding verification constraints to DB2