Documente Academic
Documente Profesional
Documente Cultură
On the Web
DB2 for i Home Page
http://www.ibm.com/systems/i/software/db2/
System i Advantages
http://www-1.ibm.com/systems/i/advantages/
System i Access
http://www.ibm.com/systems/i/access/
Software
Performance
SQL Query Engine enhancements
Recursive Expressions OLAP Support RowNumber & Rank ANS Timestamp Format TDES Encryption 2 MB SQL Statements & 32K keys OnDemand & Availability
Cross-Reference Files Robustness Automatic Journaling Enhancements SMAPP for EVIs Parallel Rollback Unlock
Usability
System i Navigator Enhancements
DB2 On Demand Performance Center SQE Plan Cache Analyzer DB2 Health Center
Resource Governor Governor Exit Point DB2 Content Manager
Scalar Functions
TIMESTAMP_FORMAT and VARCHAR_FORMAT enhancements LOCATE function fix (PTF) ENCRYPT_AES ASCII (UTF-8 result) MONTHS_BETWEEN, ROUND_TIMESTAMP, and TRUNC_TIMESTAMP
Miscellaneous
Statistics catalog views (V5R4 PTF) CLIENT special registers FOR BIT DATA and binary compatibility Output parameter support for heterogeneous CALL BX literals
Prior to this support you would have to run multiple queries CUBE and ROLLUP included in this support
VALUES in FROM
Form the cross product of this table X with the SALES table. This add columns R1 and R2 to every row. SELECT R1, R2, WEEK(SALES_DATE) AS WEEK, DAYOFWEEK(SALES_DATE) AS DAY_WEEK, MONTH(SALES_DATE) AS MONTH, REGION, SALES AS UNITS_SOLD FROM SALES, ( VALUES(GROUP 1,GROUP 2) ) AS X (R1,R2)
Equivalent to creating a temporary table, inserting rows, and then using the temporary table in the query
INSERT in FROM
Insert customer numbers into the new SALES table that has an identity column and return the generated values. CREATE TABLE SALES2 ( SALES_ID INTEGER AS IDENTITY, SALES_DATE DATE DEFAULT CURRENT DATE, SALES_PERSON FOR COLUMN SALES00001 VARCHAR(15) , REGION VARCHAR(15), SALES INTEGER ); SELECT * FROM FINAL TABLE ( INSERT INTO SALES2 ( SALES_DATE, SALES_PERSON, REGION, SALES ) SELECT * FROM SALES ) ORDER BY INPUT SEQUENCE;
Prior to this support you would have to update all columns or would have to use a different UPDATE statement for every combination of columns you wanted to update. Applies to UPDATE and INSERT VALUES, also allowed on PREPARE.
Meaning Value is provided Null value Default value Column is treated as if it had not been specified in the statement.
DECIMAL FLOAT
New numeric data type with attributes of both decimal and floating point IEEE 754R CREATE TABLE mjatst.table1 ( c1 DECFLOAT(16) , c2 DECFLOAT(34) );
DECFLOAT(16) Guarantees 16 digits of precision 8 bytes long Exponent range 10-383 to 10384 Infinity NaN SNaN special values
DECFLOAT(34) Guarantees 34 digits of precision 16 bytes long Exponent range 10-6143 to 106144 Infinity NaN SNaN special values
SQL create index enhancements for key expressions and sparse indexes. SQE can use indexes with expressions, but does not provide support for sparse indexes yet
UPDATE mjatst.table4 SET c1 = 4, c2 = FOURTH WHERE C1 = 1; SELECT c1, c2, c3 FROM mjatst.table4;
Hidden Columns
CREATE TABLE mjatst.table3 ( c1 INT, c2 VARCHAR(20), c3 TIMESTAMP IMPLICITLY HIDDEN; INSERT INTO mjatst.table3 (c1, c2, c3) VALUES (1, FIRST, CURRENT TIMESTAMP), (2, SECOND, CURRENT TIMESTAMP), (3, THIRD, CURRENT TIMESTAMP); SELECT * FROM mjatst.table3;
Join the tables on the PROD# column to get a table of all parts and products, showing the supplier information, if any. SELECT PART, SUPPLIER, PARTS.PROD#, PRODUCT FROM PARTS FULL OUTER JOIN PRODUCTS ON PARTS.PROD# = PRODUCTS.PROD#;
Equivalent to UNION ALL of LEFT OUTER JOIN and RIGHT EXCEPTION JOIN
DECLARE X CURSOR FOR SELECT * FROM transaction WITH CS SKIP LOCKED DATA OPEN X; FETCH X INTO
Datetime Functions
TIMESTAMP_FORMAT VARCHAR_FORMAT MONTHS_BETWEEN ROUND_TIMESTAMP TRUNC_TIMESTAMP Returns a timestamp from a character string representation of a timestamp according to the specified format of the string. Returns a character string representation of a timestamp, with the string in a specified format Returns an estimate of the number of months between two dates Returns a timestamp rounded to the specified unit. Returns a timestamp truncated to the specified unit.
String Functions
ASCII CHR ENCRYPT_AES Returns the ASCII code value of the leftmost character of the argument as an integer Returns the character that has the ASCII code value specified by the argument. Encrypts a string using the AES encryption algorithm
ALTER FUNCTION
ALTER FUNCTION mjatst.func1 ALTER NOT DETERMINISTIC RETURNS NULL ON NULL OUTPUT;
ALTER FUNCTION mjatst.func1 REPLACE (p1 VARCHAR(10)) RETURNS INT BEGIN DECLARE x INT; RETURN (SELECT MAX(LENGTH) FROM QSYS2.SYSCOLUMNS WHERE DATA_TYPE = p1); END;
Statements and clauses that will never be necessary on i are ignored making ports easier.
CREATE TRIGGER mjatst.trgins1 INSTEAD OF INSERT ON mjatst.v1 FOR EACH STATEMENT BEGIN END;
PTFed to V5R4
BX Literals
CREATE TABLE qtemp.binary1 (c1 VARBINARY(1000)); INSERT INTO qtemp.binary1 VALUES( BXA1B2C3D4 );
New SYSTOOLS examples: HARVEST_INDEX_ADVICE (builds an SQL script) ACT_ON_INDEX_ADVICE (creates permanent indexes)
SYSTABLESTAT
SELECT table_schema, table_name, table_partition, number_rows, number_deleted_rows FROM QSYS2.SYSPARTITIONSTAT WHERE table_schema = MJATST
New views allow simple access to statistics. These were PTFed to V5R4
SYSPACKAGESTAT SYSPARTITIONINDEXES
SYSPARTITIONMQTS
SYSPROGRAMSTAT
SELECT package_schema, package_name, package_type, number_statements, package_used_size FROM QSYS2.SYSPACKAGESTAT WHERE package_schema LIKE Q%
The values of the special registers can be changed through: The Set Client Information (SQLESETI) API. In CLI, the SQLSetConnectAttr() API. In JDBC, the setClientInfo connection method.
SELECT CURRENT CLIENT_ACCTNG AS "Client Accounting", CURRENT CLIENT_APPLNAME AS "Client Application", CURRENT CLIENT_PROGRAMID AS "Client Program", CURRENT CLIENT_USERID AS "Client User",
Provides the ability to track the real user and application. Besides direct access, database monitor will capture the values and Current SQL for a job will show values.
Interoperability DRDA
DB2 for z/O S DB2 for VM and VSE DB2 for i DB2 for AIX DB2 for HP-UX DB2 for Sun Solaris DB2 for W indows DB2 for Liniux Inform ix Txaction Attachm ate G randview HiT Software M icrosoft O racle Rocket StarQ uest Sybase/M DI W all Data XDB System s
DDM/DRDA Protocols
DDM/DRDA Protocols
DDM and DRDA IPv6 DRDA Identity tokens DRDA LOB Optimizations DRDA Authentication Methods DRDA Scrollable Cursors Output parameter support for heterogeneous CALL
6.1
Application
Server (Data)
CLI
Alias support in Metadata APIs Row-wise array INSERT Wide APIs
Embedded SQL
RPG Precompiler Variable Scoping Precompiler IFS support Unicode support in COBOL
JDBC
JDBC 4.0 Alias support in Metadata APIs Returning DEFAULT Return update counts
XDA
SQL Server Mode Serviceability improvements
.NET
Multiple-row INSERT Additional data type support Visual Studio integration Distributed transaction support Exploit ADO.NET 2.0
2008 IBM Corporation
SQE Characteristics
Parallel to Normal Release Enhancements Object Oriented Design Enhanced Performance primarily for complex queries Enhanced Optimization Engine Enhanced Statistics Encoded Vector Indexes Enhancements
SQE Delivery
First Wave Second Wave Third Wave Fourth Wave Fifth Wave
6.1 Performance
SQL Runtime Performance Improvements
Host Server Variable Length compression (V5R4 PTF) SQL CALL cache improvements Optimization time improvements Long name resolve Large page use (64K)
6.1 Availability/Recovery
Database
Logical file and MQT restore XA and DDL improvements Quiesce transactions for XSM Switchover Serviceability improvements Eliminate package corruption (V5R4 PTF)
Journaling
Statistics DDL entries Implicit library journaling (STRJRNLIB, ENDJRNLIB, SQL CREATE SCHEMA) End Journal While Open Start and End Journal *ALL objects in a library Merge APYJRNCHG and APYJRNCHGX Change journal exit point (QIBM_QJO_CHG_JRNRCV) List eligible but unprotected access paths (DSPRCYAP) Miscellaneous recovery improvements
Health Center
Environmental limits Package and procedure in Size Limits File activity Journals and receivers in Overview
Database Management
Schema based info Show object locks Label and Comment cleanup
MySQL
Most popular open source DB
Frequently used with PHP
Two stages
Stage 1 Runs AIX version of MySQL in PASE with Support by MySQL Uses existing Storage engines (MyISAM) Stage 2 Custom storage engine that integrates MySQL with DB2 for i
No-charge offering (5733-OMF) Quickly search text in DB2 columns with advanced linguistic methods OmniFind can index and search:
Adobe PDF Rich Text Format (RTF) HTML XML Lotus 123 Lotus Freelance Lotus WordPro Microsoft Excel Microsoft PowerPoint Microsoft Word Open Office 1.1 & 2.0 JustSystems Ichitaro
Systems Management
SQL Server Mixed Mode for Batch Processing
V5R4 - Database Group SF99504 Version 19 (planned) 6.1 - Database Group SF99601 Version 8 (planned)
CPYFRMIMPF performance
V5R4 - Database Group SF99504 Version 19 6.1 - Database Group SF99601 Version 8
Function
Allow Unqualified SRVPGM Names for Routines
V5R4 - Database Group SF99504 Version 21 and 22 (planned) 6.1 Database Group SF99601 Version 9 and 10 (planned)
SECURE columns
Protects secure data in a database monitor and plan cache.
Issue an SQL CALL to secure column CCNBR in table LIB1.Orders:
The valid values of the Attribute are: SECURE NO cache. - This column does not contain data that needs to be secured in a database monitor or plan
SECURE YES - This column contains data that needs to be secured in a database monitor or plan cache. All variable values for any query that references this column will not be visible in a database monitor or plan cache unless the security officer has started the database monitor or the security officer is accessing the plan cache. Notes Calling the procedure will require an exclusive lock and enough authority to alter the table. It will generate a journal entry so the HABPs can replay it on another system.
SECURE columns
Attribute VARCHAR(10) ) LANGUAGE C PARAMETER STYLE SQL MODIFIES SQL DATA SPECIFIC QDBCATTR EXTERNAL NAME 'QSYS/QDBSSUDF2(QDBCATTR)'; GRANT EXECUTE ON PROCEDURE SYSPROC.SET_COLUMN_ATTRIBUTE TO PUBLIC;
SQL CLI control provided via new connection attribute SQLSetConnectAttr() SQL_ATTR_SERVERMODE_SUBSYSTEM JDBC control provided via new connection property - servermode subsystem
Collect SQL details For all statements executed via STRSQL or RUNSQLSTM
Start SQL Interactive Session (STRSQL command) users will observe the following client special register values: CLIENT CLIENT CLIENT CLIENT CLIENT PROGRAMID = 'STRSQL' APPLNAME = 'START SQL INTERACTIVE SESSION' USERID = The current user's name WRKSTNNAME = The DB2 for i database name ACCTNG = The current user's accounting code (i.e. ACGCDE parameter on CHGUSRPRF)
Run SQL Statements (RUNSQLSTM command) users will observe the following client special register values: CLIENT CLIENT CLIENT CLIENT CLIENT PROGRAMID APPLNAME USERID WRKSTNNAME ACCTNG = 'RUNSQLSTM' = 'RUN SQL STATEMENTS' = The current user's name = The DB2 for i database name = The current user's accounting code (i.e. ACGCDE parameter on CHGUSRPRF)
Collect SQL details for all statements executed via STRSQL or RUNSQLSTM
Corporate auditing requirements (SOX) are becoming more demanding. SOX officers are responsible for establishing and maintaining internal controls. Some companies have decided to record and archive all the SQL statement activity for command interface users. The Database Monitor client register pre-filters can be used to solve this need. Example:
STRDBMON OUTFILE(QGPL/STRSQLMON1) OUTMBR(*FIRST *REPLACE) JOB(*ALL/*ALL/QPADE*) TYPE(*DETAIL) COMMENT('FTRCLTPGM(STRSQL)') <.....> ENDDBMON JOB(*ALL/*ALL/QPADE*) )
Add the following option to CREATE PROCEDURE (SQL) and ALTER PROCEDURE (SQL).
option-list >--+-------------------+-----> +-PROGRAM TYPE MAIN-+ '-PROGRAM TYPE SUB--' PROGRAM TYPE MAIN Service program calls perform faster than program calls
Specifies that the routine executes as the main entry point in a program. The external program generated will be a *PGM object.
Specifies that the routine executes as a procedure in a service program. The external program generated will be a *SRVPGM object.
Scalar Functions
XML functions MQ Series functions TIMESTAMP_FORMAT and VARCHAR_FORMAT enhancements
Miscellaneous
Parameter marker enhancements Expressions in CALL
SQE Characteristics
Parallel to Normal Release Enhancements Object Oriented Design Enhanced Performance primarily for complex queries Enhanced Optimization Engine Enhanced Statistics Encoded Vector Indexes Enhancements
SQE Delivery
First Wave Second Wave Third Wave Fourth Wave Fifth Wave Sixth Wave
SQE (Stage 7)
Logical File support Adaptive Query Processing (AQP) Other miscellaneous performance enhancements
CREATE ENCODED VECTOR INDEX idx2 ON sales (region) INCLUDE ( SUM(sales) ) SELECT region, SUM(sales) FROM sales GROUP BY region
Database
Read Currently Committed Allow transactions to span *SYSBAS and IASPs CHGPFCST CHECK(*YES *NO) CHGSRCF TEXT(*FROMMBR) SRCTYPE(*FROMMBR)
Journaling
Additional filtering based on generic names on STRJRNLIB and CHGJRNOBJ to control what journaling implicitly gets started Additional control on whether journal entries for an object(s) should be filtered on remote journaling Option 42 (HA Journal Performance)
Database Management
Support for DB enhancements Support for Omnifind indexes Large list performance Partitioned table enhancement for Show Indexes and Show MQTs Generate SQL option to include GRANTs Status Reorganize enhancements Index build ALTER TABLE Save folder contents