Invokes the bind utility, which prepares SQL statements stored in the bind file generated by the precompiler, and creates a package that is stored in the database.
Scope
This API can be called from any node in db2nodes.cfg. It updates the database catalogs on the catalog node. Its effects are visible to all nodes.
Authorization
One of the following:
The user also needs all privileges required to compile any static SQL statements in the application. Privileges granted to groups are not used for authorization checking of static statements. If the user has sysadm authority, but not explicit privileges to complete the bind, the database manager grants explicit dbadm authority automatically.
Required Connection
Database
Version
sql.h
C API Syntax
/* File: sql.h */ /* API: Bind */ /* ... */ SQL_API_RC SQL_API_FN sqlabndx ( _SQLOLDCHAR * pBindFileName, _SQLOLDCHAR * pMsgFileName, struct sqlopt * pBindOptions, struct sqlca * pSqlca); /* ... */ |
Generic API Syntax
/* File: sql.h */ /* API: Bind */ /* ... */ SQL_API_RC SQL_API_FN sqlgbndx ( unsigned short MsgFileNameLen, unsigned short BindFileNameLen, struct sqlca * pSqlca, struct sqlopt * pBindOptions, _SQLOLDCHAR * pMsgFileName, _SQLOLDCHAR * pBindFileName); /* ... */ |
API Parameters
Precede the name of a bind list file with the at sign (@). For example, a fully qualified bind list file name might be:
/u/user1/bnd/@all.lst
The bind list file should contain one or more bind file names, and must have the extension .lst.
Precede all but the first bind file name with a plus symbol (+). The bind file names may be on one or more lines. For example, the bind list file all.lst might contain:
mybind1.bnd+mybind2.bnd+ mybind3.bnd+ mybind4.bnd
Path specifications on bind file names in the list file can be used. If no path is specified, the database manager takes path information from the bind list file.
REXX API Syntax
This API can be called from REXX through the SQLDB2 interface. See How the API Descriptions are Organized, or the Application Development Guide. For a description of the syntax, see the Command Reference.
Sample Programs
Usage Notes
Binding can be done as part of the precompile process for an application program source file, or as a separate step at a later time. Use BIND when binding is performed as a separate process.
The name used to create the package is stored in the bind file, and is based on the source file name from which it was generated (existing paths or extensions are discarded). For example, a precompiled source file called myapp.sqc generates a default bind file called myapp.bnd and a default package name of MYAPP. (However, the bind file name and the package name can be overridden at precompile time by using the SQL_BIND_OPT and the SQL_PKG_OPT options in sqlaprep - Precompile Program.)
BIND executes under the transaction that the user has started. After performing the bind, BIND issues a COMMIT (if bind is successful) or a ROLLBACK (if bind is unsuccessful) operation to terminate the current transaction and start another one.
Binding halts if a fatal error or more than 100 errors occur. If a fatal error occurs during binding, BIND stops binding, attempts to close all files, and discards the package.
Binding application programs has prerequisite requirements and restrictions beyond the scope of this manual. For more detailed information about binding application programs to databases, see the Application Development Guide.
The following table lists valid values for the type and the
val fields of the bind options structure (see SQLOPT), as well as their corresponding CLP options. For
a description of the bind options (including default values), see the Command Reference.
Table 4. BIND Option Types and Values
CLP Option | Option Type | Option Values | ||
---|---|---|---|---|
ACTION ADD | SQL_ACTION_OPT | SQL_ACTION_ADD | ||
ACTION REPLACE | SQL_ACTION_OPT | SQL_ACTION_REPLACE | ||
BLOCKING ALL | SQL_BLOCK_OPT | SQL_BL_ALL | ||
BLOCKING NO | SQL_BLOCK_OPT | SQL_BL_NO | ||
BLOCKING UNAMBIG | SQL_BLOCK_OPT | SQL_BL_UNAMBIG | ||
CCSIDG | SQL_CCSIDG_OPT | sqlopt.sqloptions.val | ||
CCSIDM | SQL_CCSIDM_OPT | sqlopt.sqloptions.val | ||
CCSIDS | SQL_CCSIDS_OPT | sqlopt.sqloptions.val | ||
CHARSUB BIT | SQL_CHARSUB_OPT | SQL_CHARSUB_BIT | ||
CHARSUB DEFAULT | SQL_CHARSUB_OPT | SQL_CHARSUB_DEFAULT | ||
CHARSUB MIXED | SQL_CHARSUB_OPT | SQL_CHARSUB_MIXED | ||
CHARSUB SBCS | SQL_CHARSUB_OPT | SQL_CHARSUB_SBCS | ||
CLIPKG | SQL_CLIPKG_OPT | Integer between 3 and 30 | ||
CNULREQD NO | SQL_CNULREQD_OPT | SQL_CNULREQD_NO | ||
CNULREQD YES | SQL_CNULREQD_OPT | SQL_CNULREQD_YES | ||
COLLECTION | SQL_COLLECTION_OPT | sqlchar structure | ||
DATETIME DEF | SQL_DATETIME_OPT | SQL_DATETIME_DEF | ||
DATETIME EUR | SQL_DATETIME_OPT | SQL_DATETIME_EUR | ||
DATETIME ISO | SQL_DATETIME_OPT | SQL_DATETIME_ISO | ||
DATETIME JIS | SQL_DATETIME_OPT | SQL_DATETIME_JIS | ||
DATETIME LOC | SQL_DATETIME_OPT | SQL_DATETIME_LOC | ||
DATETIME USA | SQL_DATETIME_OPT | SQL_DATETIME_USA | ||
DECDEL COMMA | SQL_DECDEL_OPT | SQL_DECDEL_COMMA | ||
DECDEL PERIOD | SQL_DECDEL_OPT | SQL_DECDEL_PERIOD | ||
DEC 15 | SQL_DEC_OPT | SQL_DEC_15 | ||
DEC 31 | SQL_DEC_OPT | SQL_DEC_31 | ||
DEGREE 1 | SQL_DEGREE_OPT | SQL_DEGREE_1 | ||
DEGREE ANY | SQL_DEGREE_OPT | SQL_DEGREE_ANY | ||
DEGREE degree | SQL_DEGREE_OPT | Integer between 1 and 32767. | ||
DYNAMICRULES BIND | SQL_DYNAMICRULES_OPT | SQL_DYNAMICRULES_BIND | ||
DYNAMICRULES RUN | SQL_DYNAMICRULES_OPT | SQL_DYNAMICRULES_RUN | ||
DYNAMICRULES DEFINE | SQL_DYNAMICRULES_OPT | SQL_DYNAMICRULES_DEFINE | ||
DYNAMICRULES INVOKE | SQL_DYNAMICRULES_OPT | SQL_DYNAMICRULES_INVOKE | ||
EXPLAIN NO | SQL_EXPLAIN_OPT | SQL_EXPLAIN_NO | ||
EXPLAIN YES | SQL_EXPLAIN_OPT | SQL_EXPLAIN_YES | ||
EXPLAIN ALL | SQL_EXPLAIN_OPT | SQL_EXPLAIN_ALL | ||
EXPLSNAP NO | SQL_EXPLSNAP_OPT | SQL_EXPLSNAP_NO | ||
EXPLSNAP YES | SQL_EXPLSNAP_OPT | SQL_EXPLSNAP_YES | ||
EXPLSNAP ALL | SQL_EXPLSNAP_OPT | SQL_EXPLSNAP_ALL | ||
FUNCPATH | SQL_FUNCTION_PATH | sqlchar structure | ||
GENERIC | SQL_GENERIC_OPT | sqlchar structure | ||
GRANT | SQL_GRANT_OPT | sqlchar structure | ||
GRANT PUBLIC | SQL_GRANT_OPT | sqlchar structure | ||
GRANT TO USER | SQL_GRANT_USER_OPT | sqlchar structure | ||
GRANT TO GROUP | SQL_GRANT_GROUP_OPT | sqlchar structure | ||
INSERT BUF | SQL_INSERT_OPT | SQL_INSERT_BUF | ||
INSERT DEF | SQL_INSERT_OPT | SQL_INSERT_DEF | ||
ISOLATION RS | SQL_ISO_OPT | SQL_READ_STAB | ||
ISOLATION NC | SQL_ISO_OPT | SQL_NO_COMMIT | ||
ISOLATION CS | SQL_ISO_OPT | SQL_CURSOR_STAB | ||
ISOLATION RR | SQL_ISO_OPT | SQL_REP_READ | ||
ISOLATION UR | SQL_ISO_OPT | SQL_UNCOM_READ | ||
OWNER | SQL_OWNER_OPT | sqlchar structure | ||
QUALIFIER | SQL_QUALIFIER_OPT | sqlchar structure | ||
QUERYOPT | SQL_QUERYOPT_OPT | SQL_QUERYOPT_0,1,2,3,5,7,9 | ||
RELEASE COMMIT | SQL_RELEASE_OPT | SQL_RELEASE_COMMIT | ||
RELEASE DEALLOCATE | SQL_RELEASE_OPT | SQL_RELEASE_DEALLOCATE | ||
REPLVER | SQL_REPLVER_OPT | sqlchar structure | ||
RETAIN NO | SQL_RETAIN_OPT | SQL_RETAIN_NO | ||
RETAIN YES | SQL_RETAIN_OPT | SQL_RETAIN_YES | ||
SQLERROR CHECK | SQL_SQLERROR_OPT | SQL_SQLERROR_CHECK | ||
SQLERROR CONTINUE | SQL_SQLERROR_OPT | SQL_SQLERROR_CONTINUE | ||
SQLERROR NOPACKAGE | SQL_SQLERROR_OPT | SQL_SQLERROR_NOPACKAGE | ||
SQLWARN NO | SQL_SQLWARN_OPT | SQL_SQLWARN_NO | ||
SQLWARN YES | SQL_SQLWARN_OPT | SQL_SQLWARN_YES | ||
STRDEL APOSTROPHE | SQL_STRDEL_OPT | SQL_STRDEL_APOSTROPHE | ||
STRDEL QUOTE | SQL_STRDEL_OPT | SQL_STRDEL_QUOTE | ||
TEXT | SQL_TEXT_OPT | sqlchar structure | ||
TRANSFORM GROUP | SQL_TRANSFORMGROUP_OPT | sqlchar structure | ||
VALIDATE BIND | SQL_VALIDATE_OPT | SQL_VALIDATE_BIND | ||
VALIDATE RUN | SQL_VALIDATE_OPT | SQL_VALIDATE_RUN | ||
|
See Also
sqlaprep - Precompile Program.