Database server

Identify exit points for IBM® i database serving.

The database server has five different exit points defined:
  1. QIBM_QZDA_INIT
    • Called at server initiation
  2. QIBM_QZDA_NDB1
    • Called for native database requests
  3. QIBM_QZDA_SQL1
    • Called for SQL requests
  4. QIBM_QZDA_SQL2
    • Called for SQL requests
  5. QIBM_QZDA_ROI1
    • Called for retrieving object information requests and SQL catalog functions

The exit points for native database and retrieving object information have two formats defined depending on the type of function requested.

The QIBM_QZDA_INIT exit point is defined to run an exit program at server initiation. If a program is defined for this exit point, it is called each time the database server is initiated.

Exit point QIBM_QZDA_INIT format ZDAI0100

Offset Type Field Description
Dec Hex
0 0 CHAR(10) User profile name The name of the user profile that is calling the server
10 A CHAR(10) Server identifier For this exit point, the value is *SQL.
20 14 CHAR(8) Format name The user exit format name being used. For QIBM_QZDA_INIT the format name is ZDAI0100.
28 1C BINARY(4) Requested function The function being performed

The only valid value for this exit point is 0.

32 20 CHAR(63) Interface type The type of interface connecting to the server job.
95 5F CHAR(127) Interface name The name of the interface connecting to the server job.
222 DE CHAR(63) Interface level The level of the interface connecting to the server job.
Note: This format is defined by member EZDAEP in files H, QRPGSRC, QRPGLESRC, QLBLSRC and QCBLLESRC in library QSYSINC.

The QIBM_QZDA_NDB1 exit point is defined to run an exit program for native database requests for the database server. Two formats are defined for this exit point. Format ZDAD0100 is used for the following functions:

  • Create source physical file
  • Create database file, based on existing file
  • Add, clear, delete database file member
  • Override database file
  • Delete database file override
  • Delete file

Format ZDAD0200 is used when a request is received to add libraries to the library list.

Exit point QIBM_QZDA_NDB1 format ZDAD0100

Offset Type Field Description
Dec Hex
0 0 CHAR(10) User profile name The name of the user profile that is calling the server
10 A CHAR(10) Server identifier For this exit point, the value is *NDB.
20 14 CHAR(8) Format name The user exit format name being used

For the following functions, the format name is ZDAD0100.

28 1C BINARY(4) Requested function The function being performed

This field contains one of the following:

  • X'00001800' - Create source physical file
  • X'00001801' - Create database file
  • X'00001802' - Add database file member
  • X'00001803' - Clear database file member
  • X'00001804' - Delete database file member
  • X'00001805' - Override database file
  • X'00001806' - Delete database file override
  • X'00001807' - Create save file
  • X'00001808' - Clear save file
  • X'00001809' - Delete file
32 20 CHAR(128) File name Name of the file used for the requested function
160 A0 CHAR(10) Library name Name of the library that contains the file
170 AA CHAR(10) Member name Name of the member to be added, cleared, or deleted
180 B4 CHAR(10) Authority Authority to the created file
190 BE CHAR(128) Based on file name Name of the file to use when creating a file based on an existing file
318 13E CHAR(10) Based on library name Name of the library containing the based on file
328 148 CHAR(10) Override file name Name of the file to be overridden
338 152 CHAR(10) Override library name Name of the library that contains the file to be overridden
348 15C CHAR(10) Override member name Name of the member to be overridden
Note: This format is defined by member EZDAEP in files H, QRPGSRC, QRPGLESRC, QLBLSRC and QCBLLESRC in library QSYSINC.

Exit point QIBM_QZDA_NDB1 format ZDAD0200

Offset Type Field Description
Dec Hex
0 0 CHAR(10) User profile name The name of the user profile that is calling the server
10 A CHAR(10) Server identifier For this exit point, the value is *NDB.
20 14 CHAR(8) Format name The user exit format name being used. For the add to library list function, the format name is ZDAD0200.
28 1C BINARY(4) Requested function The function being performed

X'0000180C' - Add library list

32 20 BINARY(4) Number of libraries The number of libraries (the next field)
36 24 CHAR(10) Library name The library names for each library
Note: This format is defined by member EZDAEP in files H, QRPGSRC, QRPGLESRC, QLBLSRC and QCBLLESRC in library QSYSINC.

The QIBM_QZDA_SQL1 exit point is defined to run an exit point for certain SQL requests that are received for the database server. Only one format is defined for this exit point. The following are the functions that cause the exit program to be called:

  • Prepare
  • Open
  • Execute
  • Connect
  • Create package
  • Clear package
  • Delete package
  • Stream fetch
  • Execute immediate
  • Prepare and describe
  • Prepare and execute or prepare and open
  • Open and fetch
  • Execute or open
  • Return package information

Exit point QIBM_QZDA_SQL1 format ZDAQ0100

Offset Type Field Description
Dec Hex
0 0 CHAR(10) User profile name The name of the user profile that is calling the server
10 A CHAR(10) Server identifier For this exit point, the value is *SQLSRV.
20 14 CHAR(8) Format name The user exit format name being used. For QIBM_QZDA_SQL1, the format name is ZDAQ0100.
28 1C BINARY(4) Requested function The function being performed

This field contains one of the following:

  • X'00001800' - Prepare
  • X'00001803' - Prepare and describe
  • X'00001804' - Open/Describe
  • X'00001805' - Execute
  • X'00001806' - Execute immediate
  • X'00001809' - Connect
  • X'0000180C' - Stream fetch
  • X'0000180D' - Prepare and execute
  • X'0000180E' - Open and fetch
  • X'0000180F' - Create package
  • X'00001810' - Clear package
  • X'00001811' - Delete package
  • X'00001812' - Execute or open
  • X'00001815' - Return package information
32 20 CHAR(18) Statement name Name of the statement used for the prepare or execute functions
50 32 CHAR(18) Cursor name Name of the cursor used for the open function. If the actual cursor name is greater than 18 bytes, the following special value is passed, indicating that the cursor name is obtained from the Extended cursor name field:
  • *EXTDCRSR
68 44 CHAR(2) Prepare option Option used for the prepare function
70 46 CHAR(2) Open attributes Option used for the open function
72 48 CHAR(10) Extended dynamic package name Name of the extended dynamic SQL package
82 52 CHAR(10) Package library name Name of the library for extended dynamic SQL package.
92 5C BINARY(2) DRDA indicator
  • 0 - Connected to local RDB
  • 1 - Connected to remote RDB
94 5E CHAR(1) Isolation level
  • 'A' - Commit *ALL
  • 'C' - Commit *CHANGE
  • 'N' - Commit *NONE
  • 'L' - Commit *RR (repeatable read)
  • 'S' - Commit *CS (cursor stability)
95 5F CHAR(512) First 512 bytes of the SQL statement text First 512 bytes of the SQL statement
607 25F CHAR(258) Extended cursor name The extended cursor name
Note: This format is defined by member EZDAEP in files H, QRPGSRC, QRPGLESRC, QLBLSRC and QCBLLESRC in library QSYSINC.

The QIBM_QZDA_SQL2 exit point is defined to run an exit point for certain SQL requests that are received for the database server. The QIBM_QZDA_SQL2 exit point takes precedence over the QIBM_QZDA_SQL1 exit point. If a program is registered for the QIBM_QZDA_SQL2 exit point, it will be called and a program for the QIBM_QZDA_SQL1 exit point will not be called. The following are the functions that cause the exit program to be called:

  • Prepare
  • Open
  • Execute
  • Connect
  • Create package
  • Clear package
  • Delete package
  • Stream fetch
  • Execute immediate
  • Prepare and describe
  • Prepare and execute or prepare and open
  • Open and fetch
  • Execute or open
  • Return package information

Table A-6. Exit point QIBM_QZDA_SQL2 format ZDAQ0200

Offset Type Field Description
Dec Hex
0 0 CHAR(10) User profile name The name of the user profile that is calling the server
10 A CHAR(10) Server identifier For this exit point, the value is *SQLSRV.
20 14 CHAR(8) Format name The user exit format name being used. For QIBM_QZDA_SQL2, the format name is ZDAQ0200.
28 1C BINARY(4) Requested function The function being performed

This field contains one of the following:

  • X'00001800' - Prepare
  • X'00001803' - Prepare and describe
  • X'00001804' - Open/Describe
  • X'00001805' - Execute
  • X'00001806' - Execute immediate
  • X'00001809' - Connect
  • X'0000180C' - Stream fetch
  • X'0000180D' - Prepare and execute
  • X'0000180E' - Open and fetch
  • X'0000180F' - Create package
  • X'00001810' - Clear package
  • X'00001811' - Delete package
  • X'00001812' - Execute or open
  • X'00001815' - Return package information
32 20 CHAR(18) Statement name Name of the statement used for the prepare or execute functions
50 32 CHAR(18) Cursor name Name of the cursor used for the open function. If the actual cursor name is greater than 18 bytes, the following special value is passed, indicating that the cursor name is obtained from the Extended cursor name field:
  • *EXTDCRSR
68 44 CHAR(2) Prepare option Option used for the prepare function
70 46 CHAR(2) Open attributes Option used for the open function
72 48 CHAR(10) Extended dynamic package name Name of the extended dynamic SQL package
82 52 CHAR(10) Package library name Name of the library for extended dynamic SQL package.
92 5C BINARY(2) DRDA indicator
  • 0 - Connected to local RDB
  • 1 - Connected to remote RDB
94 5E CHAR(1) Isolation level
  • 'A' - Commit *ALL
  • 'C' - Commit *CHANGE
  • 'N' - Commit *NONE
  • 'L' - Commit *RR (repeatable read)
  • 'S' - Commit *CS (cursor stability)
95 5F CHAR(10) Default SQL schema Name of the default SQL schema used by the Database Server
105 69 CHAR(3)   Reserved
108 6C BINARY(4) Offset to the extended cursor name The offset int his structure to the extended cursor name
112 70 BINARY(4) Length of the extended cursor name The length, in bytes, of the extended cursor name
116 74 CHAR(118)   Reserved
234 EA BINARY(4) SQL statement text length Length of SQL statement text in the field that follows. The length can be a maximum of 2 MB (2,097,152 bytes).
238 EE CHAR(*) SQL statement text Entire SQL statement
* * CHAR(*) Extended cursor name The extended cursor name
Note: This format is defined by member EZDAEP in files H, QRPGSRC, QRPGLESRC, QLBLSRC and QCBLLESRC in library QSYSINC.

The QIBM_QZDA_ROI1 exit point is defined to run an exit program for the requests that retrieve information about certain objects for the database server. It is also used for SQL catalog functions.

This exit point has two formats defined. These formats are described below.

Format ZDAR0100 is used for requests to retrieve information for the following objects:

  • Library (or collection)
  • File (or table)
  • Field (or column)
  • Index
  • Relational database (or RDB)
  • SQL package
  • SQL package statement
  • File member
  • Record format
  • Special columns

Format ZDAR0200 is used for requests to retrieve information for the following objects:

  • Foreign keys
  • Primary keys

Exit point QIBM_QZDA_ROI1 format ZDAR0100

Offset Type Field Description
Dec Hex
0 0 CHAR(10) User profile name The name of the user profile that is calling the server
10 A CHAR(10) Server identifier For the database server, the value is *RTVOBJINF.
20 14 CHAR(8) Format name The user exit format name being used. For the following functions, the format name is ZDAR0100.
28 1C BINARY(4) Requested function The function being performed

This field contains one of the following:

  • X'00001800' - Retrieve library information
  • X'00001801' - Retrieve relational database information
  • X'00001802' - Retrieve SQL package information
  • X'00001803' - Retrieve SQL package statement
  • X'00001804' - Retrieve file information
  • X'00001805' - Retrieve file member information
  • X'00001806' - Retrieve record format information
  • X'00001807' - Retrieve field information
  • X'00001808' - Retrieve index information
  • X'0000180B' - Retrieve special column information
32 20 CHAR(20) Library name The library or search pattern used when retrieving information about libraries, packages, package statements, files, members, record formats, fields, indexes, and special columns
52 34 CHAR(36) Relational database name The relational database name or search pattern used to retrieve RDB information
88 58 CHAR(20) Package name The package name or search pattern used to retrieve package or package statement information
108 6C CHAR(256) File name (SQL alias name) The file name or search pattern used to retrieve file, member, record format, field, index, or special column information
364 16C CHAR(20) Member name The member name or search pattern used to retrieve file member information
384 180 CHAR(20) Format name The format name or search pattern used to retrieve record format information
Note: This format is defined by member EZDAEP in files H, QRPGSRC, QRPGLESRC, QLBLSRC and QCBLLESRC in library QSYSINC.

Exit point QIBM_QZDA_ROI1 format ZDAR0200

Offset Type Field Description
Dec Hex
0 0 CHAR(10) User profile name The name of the user profile that is calling the server
10 A CHAR(10) Server identifier For the database server, the value is *RTVOBJINF.
20 14 CHAR(8) Format name The user exit format name being used. For the following functions, the format name is ZDAR0200.
28 1C BINARY(4) Requested function The function being performed

This field contains one of the following:

  • X'00001809' - Retrieve foreign key information
  • X'0000180A' - Retrieve primary key information
32 20 CHAR(10) Primary key table library name The name of the library that contains the primary key table used when retrieving primary and foreign key information
42 2A CHAR(128) Primary key table name (alias name) The name of the table that contains the primary key used when retrieving primary or foreign key information
170 AA CHAR(10) Foreign key table library name The name of the library that contains the foreign key table used when retrieving foreign key information
180 64 CHAR(128) Foreign key table name (alias name) The name of the table that contains the foreign key used when retrieving foreign key information
Note: This format is defined by member EZDAEP in files H, QRPGSRC, QRPGLESRC, QLBLSRC and QCBLLESRC in library QSYSINC.