IBM Books

What's New


Chapter 4. Application Development Enhancements

  • ADO, RDO, and MTS Sample Programs
  • Increased SQL Object Identifier Lengths
  • Increased Maximum SQL Statement Length
  • Row Type Enhancements
  • Reference Type Representation
  • Create Views Without Object Identifier (OID) Checks
  • Create Views Covering Multiple Hierarchies
  • Drop Table or View Hierarchies
  • Improved Security for ONLY Clause
  • Name Hierarchy Table for Typed Table
  • Extended Support for TYPE Predicates
  • Check Constraints for Typed Tables
  • Stored Procedure Enhancements
  • Compatibility Enhancements
  • Behavior Enhancements
  • Host and AS/400 Client Support for Multiple Result Set Stored Procedures
  • Security for Dynamic SQL
  • C Macro Expansion
  • Scrollable Cursors

  • ADO, RDO, and MTS Sample Programs

    To help you develop DB2 applications for Windows 32-bit operating systems, the DB2 Personal Developer's Edition and DB2 Universal Developer's Edition products include:

    These samples are supplied with the DB2 Software Developer's Kit for Windows 32-bit operating systems only.


    Increased SQL Object Identifier Lengths

    To enable you to use more informative SQL object identifiers, DB2 Universal Database Version 6 increases the maximum length of table names, view names, summary table names, alias names and correlation names from 18 bytes to 128 bytes. The maximum length of column names has been increased from 18 bytes to 30 bytes. For more information on SQL object identifier lengths , refer to the SQL Reference .


    Increased Maximum SQL Statement Length

    In DB2 Universal Database Version 6, the maximum SQL statement size is 65 535 bytes. You can use longer statements to create more complex SQL statements in your applications. For more information on SQL statement sizes, refer to the SQL Reference .


    Row Type Enhancements

    Object-relational support in DB2 Universal Database Version 6 has been enhanced to enable you to make better use of row types. The following extensions to table and view hierarchies have been introduced. For more information on typed tables and row types, refer to the SQL Reference .

    Reference Type Representation

    Instead of only representing reference types with the underlying type VARCHAR(16) FOR BIT DATA, you can now choose the underlying type from any supported data type. Use the CREATE TYPE statement to name the representation type used for references to the new structured type.

    For more information on the CREATE TYPE statement, refer to the SQL Reference .

    Create Views Without Object Identifier (OID) Checks

    DB2 Version 6 makes it easier for you to define object views, also called typed views, on tables. You can use the UNCHECKED option in your CREATE VIEW statement to prevent DB2 from checking for a unique object identifier. This option is useful, for example, when you know that your data conforms to the uniqueness rule but it does not comply with the rules that allows DB2 to prove uniqueness.

    Create Views Covering Multiple Hierarchies

    You can create typed view hierarchies that range over multiple legacy tables, legacy views, or typed table hierarchies. To create a view covering multiple hierarchies, use the unchecked OID feature previously described in "Create Views Without Object Identifier (OID) Checks" and declare the view using one of the following techniques:

    Drop Table or View Hierarchies

    You can drop entire hierarchies of tables or views using the DROP TABLE HIERARCHY and DROP VIEW HIERARCHY statements, respectively.

    Improved Security for ONLY Clause

    DB2 Version 6 improves the security of your database for SELECT, UPDATE, or DELETE statements with an ONLY clause. To issue such a statement, a user requires SELECT privilege on the target table and all of its sub-tables. This restriction prevents a user who is authorized to access a table but not one of its subtables from discovering which rows in the table are rows of the subtable.

    For example, a user who is authorized to access the EMPLOYEE table but not the MANAGER subtable should not be allowed to discover which employees are managers by executing the query (SELECT NAME FROM EMP) EXCEPT (SELECT NAME FROM ONLY(EMP)).

    Name Hierarchy Table for Typed Table

    You can explicitly name the hierarchy table that implements a typed table using the HIERARCHY clause in the CREATE TABLE statement for the typed root table.

    Extended Support for TYPE Predicates

    DB2 Version 6 extends support for TYPE predicates by supporting the use of the NOT keyword, as well as the optional phrase OF DYNAMIC TYPE.

    Check Constraints for Typed Tables

    You can attach check constraints to a typed table. The check constraint is enforced against any action that affects a row of the typed table, even if the action is initiated against a supertable or subtable of the typed table.


    Stored Procedure Enhancements

    Stored procedures offer improved compatibility both with industry standards and with the DB2 family. When you write DB2 Universal Database Version 6 stored procedures, you can use the CREATE PROCEDURE statement to register the stored procedure in the database and define their behavior. To help you create and debug stored procedures on the AIX, OS/390, and Windows 32-bit operating systems, you can use the Stored Procedure Builder.

    Compatibility Enhancements

    Behavior Enhancements

    Some of the ways in which CREATE PROCEDURE allows you to control the behavior of your stored procedures include:

    FENCED | NOT FENCED
    specifies whether the stored procedure runs in FENCED or NOT FENCED mode

    PROGRAM TYPE SUB | MAIN
    specify whether the stored procedure accepts arguments as a subroutine or as a main() function in a C program

    DBINFO | NO DBINFO
    specify whether the stored procedure receives additional information as an argument

    NO SQL | CONTAINS SQL | READS SQL | MODIFIES SQL DATA
    specifies the SQL operations that the stored procedure is allowed to perform

    Host and AS/400 Client Support for Multiple Result Set Stored Procedures

    Host and AS/400 clients can invoke a stored procedure and retrieve multiple row result sets from the stored procedure on a DB2 Universal Database Version 6 server. For more information on writing stored procedures that return multiple result sets, refer to the Application Development Guide .


    Security for Dynamic SQL

    DB2 Universal Database Version 6 enables you to specify the privilege model used by a dynamic SQL application via the DYNAMICRULES bind option. If you bind an application using the DYNAMICRULES BIND option, any user with EXECUTE privilege on the package inherits the privileges of your authorization ID. To associate a different authorization ID with the package, you can use the OWNER BIND option.

    For more information on dynamic SQL security options, refer to the BIND command in the Command Reference .


    C Macro Expansion

    You can use C macros in a declaration within a declare section of a C/C++ application if you preprocess the source file with an external C preprocessor. For more information on C Macro Expansion , refer to the Application Development Guide .


    Scrollable Cursors

    DB2 Universal Database Version 6 supports the ability to scroll through a cursor using DB2 Call Level Interface (DB2 CLI), Open Database Connectivity (ODBC), Java Database Connectivity (JDBC), or Embedded SQL for Java (SQLJ):

    The following table summarizes the two types of scrollable cursor support provided by DB2 Universal Database Version 6:

    Table 1. Scrollable Cursor Support
    Cursor Type Description Application Support
    static, read-only cannot add, delete, or modify any values, and is not affected by other applications that access the same data as the cursor

    • DB2 CLI

    • ODBC

    • JDBC

    • SQLJ

    keyset-driven can detect changes to the underlying data, and can use the cursor to make changes to the underlying data

    • DB2 CLI

    • ODBC

    For more information on DB2 CLI and ODBC scrollable cursors , refer to the CLI Guide and Reference . For more information on JDBC scrollable cursors and SQLJ result set iterators , refer to the Application Development Guide .


    [ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

    [ DB2 List of Books | Search the DB2 Books ]