Creating C and C++ routines
Procedures and functions that reference a C or C++ library are created in a similar way to external routines with other implementations. This task comprises a few steps including the formulation of the CREATE statement for the routine, the coding of the routine implementation, precompilation, compilation and linking of code, and the deployment of source code.
Before you begin
- Knowledge of C and C++ routine implementation. To learn about C and C++ routines in general see:
- The IBM® data server client which includes application development support must be installed on the client computer.
- The database server must be running an operating system that supports a C or C++ compiler that is supported by the database.
- The required compilers must be installed on the database server.
- Authority to execute the CREATE statement for the external routine. For the privileges required to execute the CREATE PROCEDURE statement or the CREATE FUNCTION statement, see the documentation for the statement.
About this task
You would choose to implement a C or C++ routine if:
- You want to encapsulate complex logic into a routine that accesses the database or that performs an action outside of the database.
- You require the encapsulated logic to be invoked from any of: multiple applications, the CLP, another routine (procedure, function (UDF), or method), or a trigger.
- You are most comfortable coding this logic using an embedded SQL programming language such as C or C++.