DB2 Version 10.1 for Linux, UNIX, and Windows

sqledbdesc data structure

The Database Description Block (SQLEDBDESC) structure can be used during a call to the sqlecrea API to specify permanent values for database attributes. These attributes include database comment, collating sequences, and table space definitions.

Table 1. Fields in the SQLEDBDESC Structure
Field Name Data Type Description
SQLDBDID CHAR(8) A structure identifier and "eye-catcher" for storage dumps. It is a string of eight bytes that must be initialized with the value of SQLE_DBDESC_2 (defined in sqlenv). The contents of this field are validated for version control.
SQLDBCCP INTEGER The code page of the database comment. This value is no longer used by the database manager.
SQLDBCSS INTEGER A value indicating the source of the database collating sequence. Note: Specify SQL_CS_NONE to specify that the collating sequence for the database is IDENTITY (which implements a binary collating sequence). SQL_CS_NONE is the default.
SQLDBUDC CHAR(256) If SQLDBCSS is set to SQL_CS_USER, the nth byte of this field contains the sort weight of the code point whose underlying decimal representation is n in the code page of the database. If SQLDBCSS is set to SQL_CS_UNICODE, this field contains the language-aware or locale-sensitive UCA-based collation name (a NULL terminated string up to 128 bytes in length). If SQLDBCSS is not equal to SQL_CS_USER or SQL_CS_UNICODE, this field is ignored.
SQLDBCMT CHAR(30) The comment for the database.
SQLDBSGP INTEGER Reserved field. No longer used.
SQLDBNSG SHORT A value that indicates the number of file segments to be created in the database. The minimum value for this field is 1 and the maximum value for this field is 256. If a value of -1 is supplied, this field will default to 1. Note: SQLDBNSG set to zero produces a default for Version 1 compatibility.
SQLTSEXT INTEGER A value, in 4KB pages, which indicates the default extent size for each table space in the database. The minimum value for this field is 2 and the maximum value for this field is 256. If a value of -1 is supplied, this field will default to 32.
SQLCATTS Pointer A pointer to a table space description control block, SQLETSDESC, which defines the catalog table space. If null, a default catalog table space based on the values of SQLTSEXT and SQLDBNSG will be created.
SQLUSRTS Pointer A pointer to a table space description control block, SQLETSDESC, which defines the user table space. If null, a default user table space based on the values of SQLTSEXT and SQLDBNSG will be created.
SQLTMPTS Pointer A pointer to a table space description control block, SQLETSDESC, which defines the system temporary table space. If null, a default system temporary table space based on the values of SQLTSEXT and SQLDBNSG will be created.
The table space description block structure (SQLETSDESC) is used to specify the attributes of any of the three initial table spaces.
Table 2. Fields in the SQLETSDESC Structure
Field Name Data Type Description
SQLTSDID CHAR(8) A structure identifier and "eye-catcher" for storage dumps. It is a string of eight bytes that must be initialized with the value of SQLE_DBTSDESC_1 (defined in sqlenv). The contents of this field are validated for version control.
SQLEXTNT INTEGER Table space extent size, in 4 KB pages. If a value of -1 is supplied, this field will default to the current value of the dft_extent_sz configuration parameter.
SQLPRFTC INTEGER Table space prefetch size, in 4 KB pages. If a value of -1 is supplied, this field will default to the current value of the dft_prefetch_sz configuration parameter.
SQLFSCACHING UNSIGNED CHAR File system caching. If a value of 1 is supplied, file system caching will be OFF for the current table space. If a value of 0 is supplied, file system caching will be ON for the current table space. Specify 2 to indicate the default setting. In this case, file system caching will be OFF on AIX®, Linux, Solaris, and Windows except on AIX JFS, Linux on System z®, Solaris non-VxFS for SMS temporary table space files, and for SMS Large Object files or Large Files. File system caching will be ON for all other platforms.
SQLPOVHD DOUBLE Table space I/O usage, in milliseconds. If a value of -1 is supplied, this field will default to an internal database manager value (currently 24.1 ms) that could change with future releases.
SQLTRFRT DOUBLE Table space I/O transfer rate, in milliseconds. If a value of -1 is supplied, this field will default to an internal database manager value (currently 0.9 ms) that could change with future releases.
SQLTSTYP CHAR(1) Indicates whether the table space is system-managed or database-managed. .
SQLCCNT SMALLINT Number of containers being assigned to the table space. Indicates how many SQLCTYPE/SQLCSIZE/SQLCLEN/SQLCONTR values follow.
CONTAINR Array An array of sqlccnt SQLETSCDESC structures.
Table 3. Fields in the SQLETSCDESC Structure
Field Name Data Type Description
SQLCTYPE CHAR(1) Identifies the type of this container. .
SQLCSIZE INTEGER Size of the container identified in SQLCONTR, specified in 4KB pages. Valid only when SQLTSTYP is set to SQL_TBS_TYP_DMS.
SQLCLEN SMALLINT Length of following SQLCONTR value.
SQLCONTR CHAR(256) Container string.
Valid values for SQLDBCSS (defined in sqlenv) are:
SQL_CS_SYSTEM
For non-Unicode databases, this is the default option, with the collating sequence based on the database territory. For Unicode databases, this option is equivalent to the IDENTITY option. If you pass a NULL pointer, the collating sequence of the operating system (based on the current locale code and the code page) is used. This is the same as specifying SQLDBCSS equal to SQL_CS_SYSTEM (0).
SQL_CS_USER
Collation sequence is specified by the 256-byte weight table supplied by the user. Each weight in the table is one byte in length.
SQL_CS_NONE
Identity collating sequence, in which strings are compared byte for byte. This is the default for Unicode databases.
SQL_CS_COMPATABILITY
Use pre-Version collating sequence.
SQL_CS_SYSTEM_NLSCHAR
Collating sequence from system using the NLS version of compare routines for character types. This value can only be specified when creating a Thai TIS620-1 database.
SQL_CS_USER_NLSCHAR
Collation sequence is specified by the 256-byte weight table supplied by the user. Each weight in the table is one byte in length. This value can only be specified when creating a Thai TIS620-1 database.
SQL_CS_IDENTITY_16BIT
CESU-8 (Compatibility Encoding Scheme for UTF-16: 8-Bit) collation sequence as specified by the Unicode Technical Report #26, available at the Unicode Consortium website (www.unicode.org). This value can only be specified when creating a Unicode database.
SQL_CS_UCA400_NO
UCA (Unicode Collation Algorithm) collation sequence based on the Unicode Standard version 4.0.0 with normalization implicitly set to 'on'. Details of the UCA can be found in the Unicode Technical Standard #10 available at the Unicode Consortium website (www.unicode.org). This value can only be specified when creating a Unicode database.
Important: Collations based on the Unicode Collation Algorithm of the Unicode Standard version 4.0.0 have been deprecated in Version 10.1 and might be removed in a future release. For more information, see Collations based on the Unicode Collation Algorithm of the Unicode Standard version 4.0.0 have been deprecated.
SQL_CS_UCA400_LSK
The UCA (Unicode Collation Algorithm) collation sequence that is based on the Unicode Standard version 4.0.0 but will sort Slovakian characters in the appropriate order. Details of the UCA can be found in the Unicode Technical Standard #10, which is available at the Unicode Consortium website (www.unicode.org). This value can only be specified when creating a Unicode database.
Important: Collations based on the Unicode Collation Algorithm of the Unicode Standard version 4.0.0 have been deprecated in Version 10.1 and might be removed in a future release. For more information, see Collations based on the Unicode Collation Algorithm of the Unicode Standard version 4.0.0 have been deprecated.
SQL_CS_UCA400_LTH
UCA (Unicode Collation Algorithm) collation sequence based on the Unicode Standard version 4.0.0, with sorting of all Thai characters according to the Royal Thai Dictionary order. Details of the UCA can be found in the Unicode Technical Standard #10 available at the Unicode Consortium website (www.unicode.org). This value can only be specified when creating a Unicode database.
Important: Collations based on the Unicode Collation Algorithm of the Unicode Standard version 4.0.0 have been deprecated in Version 10.1 and might be removed in a future release. For more information, see Collations based on the Unicode Collation Algorithm of the Unicode Standard version 4.0.0 have been deprecated.
SQL_CS_UNICODE

Collating sequence is language-based for a Unicode database. The specific collation name is specified in the SQLDBUDC field and must be terminated with a 0x00 byte. The collation name can identify any language-aware collation as defined in "Language-aware collations for Unicode data" or any locale-sensitive UCA-based collation identified in "Unicode Collation Algorithm based collations".

For example, to use collation equivalent to US English in code page 819, set SQLDBCSS to SQL_CS_UNICODE and SQLDBUDC to SYSTEM_819_US.

Note: When CREATE DATABASE is performed against a server earlier than Version 9.5, this option cannot be used. By default, a Unicode database on such a server will be created with SYSTEM collation.
Valid values for SQLTSTYP (defined in sqlenv) are:
SQL_TBS_TYP_SMS
System managed
SQL_TBS_TYP_DMS
Database managed
Valid values for SQLCTYPE (defined in sqlenv) are:
SQL_TBSC_TYP_DEV
Device. Valid only when SQLTSTYP = SQL_TBS_TYP_DMS.
SQL_TBSC_TYP_FILE
File. Valid only when SQLTSTYP = SQL_TBS_TYP_DMS.
SQL_TBSC_TYP_PATH
Path (directory). Valid only when SQLTSTYP = SQL_TBS_TYP_SMS.

API and data structure syntax

SQL_STRUCTURE sqledbdesc
{
        _SQLOLDCHAR sqldbdid[8];
        sqlint32 sqldbccp;
        sqlint32 sqldbcss;
        unsigned char  sqldbudc[SQL_CS_SZ];
        _SQLOLDCHAR sqldbcmt[SQL_CMT_SZ+1];
        _SQLOLDCHAR pad[1];
        sqluint32 sqldbsgp;
        short sqldbnsg;
        char pad2[2];
        sqlint32 sqltsext;
        struct SQLETSDESC *sqlcatts;
        struct SQLETSDESC *sqlusrts;
        struct SQLETSDESC *sqltmpts;
};

SQL_STRUCTURE SQLETSDESC
{
        char sqltsdid[8];
        sqlint32 sqlextnt;
        sqlint32 sqlprftc;
        double sqlpovhd;
        double sqltrfrt;
        char sqltstyp;
        unsigned char  sqlfscaching;
        short sqlccnt;
        struct SQLETSCDESC containr[1];
};

SQL_STRUCTURE SQLETSCDESC
{
        char sqlctype;
        char pad1[3];
        sqlint32 sqlcsize;
        short sqlclen;
        char sqlcontr[SQLB_MAX_CONTAIN_NAME_SZ];
        char pad2[2];
};

sqledbdesc structure parameters

pad1
Reserved. Used for structure alignment and should not to be populated by user data.
pad2
Reserved. Used for structure alignment and should not to be populated by user data.

SQLETSCDESC structure parameters

pad1
Reserved. Used for structure alignment and should not to be populated by user data.
pad2
Reserved. Used for structure alignment and should not to be populated by user data.

COBOL Structure

* File: sqlenv.cbl
01 SQLEDBDESC.
    05 SQLDBDID               PIC X(8).
    05 SQLDBCCP               PIC S9(9) COMP-5.
    05 SQLDBCSS               PIC S9(9) COMP-5.
    05 SQLDBUDC               PIC X(256).
    05 SQLDBCMT               PIC X(30).
    05 FILLER                 PIC X.
    05 SQL-PAD                PIC X(1).
    05 SQLDBSGP               PIC 9(9) COMP-5.
    05 SQLDBNSG               PIC S9(4) COMP-5.
    05 SQL-PAD2               PIC X(2).
    05 SQLTSEXT               PIC S9(9) COMP-5.
    05 SQLCATTS               USAGE IS POINTER.
    05 SQLUSRTS               USAGE IS POINTER.
    05 SQLTMPTS               USAGE IS POINTER.
* 


* File: sqletsd.cbl
01 SQLETSDESC.
    05 SQLTSDID               PIC X(8).
    05 SQLEXTNT               PIC S9(9) COMP-5.
    05 SQLPRFTC               PIC S9(9) COMP-5.
    05 SQLPOVHD               USAGE COMP-2.
    05 SQLTRFRT               USAGE COMP-2.
    05 SQLTSTYP               PIC X.
    05 SQL-PAD1               PIC X.
    05 SQLCCNT                PIC S9(4) COMP-5.
    05 SQL-CONTAINR OCCURS 001 TIMES.
        10 SQLCTYPE           PIC X.
        10 SQL-PAD1           PIC X(3).
        10 SQLCSIZE           PIC S9(9) COMP-5.
        10 SQLCLEN            PIC S9(4) COMP-5.
        10 SQLCONTR           PIC X(256).
        10 SQL-PAD2           PIC X(2).
* 


* File: sqlenv.cbl
01 SQLETSCDESC.
    05 SQLCTYPE               PIC X.
    05 SQL-PAD1               PIC X(3).
    05 SQLCSIZE               PIC S9(9) COMP-5.
    05 SQLCLEN                PIC S9(4) COMP-5.
    05 SQLCONTR               PIC X(256).
    05 SQL-PAD2               PIC X(2).
*