IBM DB2 Connect 简介
IBM Db2 11 for z OS 产品说明说明书

IBM Licensed ProgramSpecificationsIBM Db2 11 for z/OSLicensed Program SpecificationsProduct Number5615-DB2IBM®Db2®11 for z/OS®is a relational database management system licensed program for the z/OS environment.IBM has embarked on an effort to rebrand DB2 to Db2. (See /Rebrand4Db2.) As such, there will be changes to all the Db2 offerings. For example, “DB2 for z/OS” is now referred to as “Db2 for z/OS,” beginning with Db2 11 for z/OS. While IBM implements the product name change across the Db2 family of products, be aware that you might see references to the original name “DB2 for z/OS” or “DB2” in different IBM web pages and documents. Clients can be sure that “DB2 for z/OS” and “Db2 for z/OS” refer to the same product, when the PID, Entitlement Entity, version, modification, and release information match.In this document, Db2 11 for z/OS is sometimes referred to as “Db2 for z/OS,” “Db2 11,” or “Db2.”HighlightsDb2 for z/OS is a licensed program that supports the relational data model with a high-level language to access Db2 data. Db2 offers many functions in support of traditional database application areas, web and mobile devices, and business intelligence. The highlights of this licensed program and its functions are described below.v Relational data model: Db2 provides a tabular data structure. Users view data as a series of rows and columns. Db2 for z/OS provides hybrid data-server support for both relational and pureXML®storage, with services to support both data structures.v Structured query language: Structured query language (SQL) is a high-level language that is used for data manipulation, data definition, and control. SQL does not depend on data paths, placement, or order when it accesses relational databases. In Db2 11 for z/OS, enhancements to SQL facilitate easier portability of applications from other members of the Db2 family or from other database products.v pureXML: Db2 for z/OS supports XML data. With pureXML, your client applications can manage XML data in Db2 tables. In Db2 11 for z/OS, enhancements to pureXML improve productivity, help optimize performance, and improve consistency across the Db2 family of products. Key enhancements include support for the XML data type for the cross-loader function, improved evaluation of some XPath predicate expressions, and improved performance when loading binary XML data.v Access to data: Db2 provides robust availability and can be accessed by many applications, including:–IBM Information Management System (IMS) Transaction Manager–IBM Customer Information Control System (CICS®) Transaction Server–IBM Time Sharing Option (TSO) users–IBM Data Server Driver Package–Web and mobile devices–WebSphere®Application Server–Batch jobsApplication programs that run under the control of IMS Transaction Manager or the CICS Transaction Server can also access Db2 data, IMS data, or both. The data sharing function allows a group of Db2 subsystems to have concurrent access to the same data without replication.In addition, Db2 can access, or be accessed by, different instances of Db2 or by other database management systems that support Distributed Relational Database Architecture™(DRDA). Thesesystems must be connected to the local Db2 subsystem by TCP/IP or Advanced Communication Facility/Virtual Telecommunications Access Method (ACF/VTAM®). Each data sharing member or non-data sharing subsystem can have up to 150,000 concurrent connections; up to 20,000 of those connections can be active at one time. Data can be changed and read by more than one subsystem in a single unit of work, and the commit processing of all data is coordinated. Other programs can access the data at the same time.v Application programming: Programmers can use integrated development environments (Java™, WebSphere Studio Enterprise Developer, or Microsoft .NET), many languages, and many access styles to access Db2. Users can access and manipulate Db2 data by using SQL through application programs that are written in Java, JavaScript, C#, APL2®, Perl, PHP, Ruby on Rails, SQL procedural language, REXX, C, C++, COBOL, Fortran, PL/I, or assembler language. C and C++ applications can use embedded SQL or ODBC. Programmers can write applications that are written in the Java programming language and that access Db2 for z/OS data or data on any DRDA server. These applications can access data either dynamically through JDBC or through static embedded SQL by using pureQuery®or SQLJ.You can use the following other methods to develop or run applications:–Use one of the several types of IBM data server clients and drivers if the application is running on a distributed environment, such as UNIX, Windows, or Linux.–Use one of the IBM Db2 Query Management Facility™(QMF™) licensed programs.–Use the IBM Rational®Developer for System z®application development workbench, which provides an integrated set of tools that support end-to-end, model-based development, runtime testing, and rapid deployment of simple and complex applications.–Use the integrated set of Db2 Development Add-Ins for Microsoft Visual Studio .NET that are provided through IBM Data Studio to support iterative development of server-side storedprocedures and user-defined functions.–Use Optim™Development Studio to develop and test SQL, PL/SQL, and Java database routines, generate and deploy database web services, create and run SQL and XQuery scripts, and develop Java database applications.–Use Optim pureQuery Runtime for z/OS to build high-quality, better performing database applications, and then deploy pureQuery or pureQuery-enabled Java applications to production environments.–Use the tools that are provided with Optim Query Workload Tuner to analyze queries and to analyze and monitor query workloads that run on data servers.v Migration: Db2 11 for z/OS for z/OS supports migration from DB2®10 for z/OS. Migration with fallback protection is available for customers who are running on DB2 10 for z/OS in new-function mode. In addition, DB2 10 for z/OS can coexist with Db2 11 for z/OS in a data sharing environment and in a distributed environment.Optional featuresDb2 11 for z/OS delivers a variety of optional features. Each optional feature includes a Program Directory.Specified operating environmentDb2 11 for z/OS has hardware and software requirements for the operating environment, which are identified in detail in the Db2 11 for z/OS Program Directory.2CompatibilityDb2 11 for z/OS is upwardly compatible with earlier releases of Db2 for z/OS. Migration with full fallback protection is available for customers who are running on DB2 10 for z/OS. Existing customers should ensure that they are successfully running on DB2 10 for z/OS (new-function mode) before migrating to Db2 11.Licensed program materials availabilityRestricted materials - No. This licensed program is available without source licensed program materials. It is available in object code.Supplemental termsDesignated machine identificationDesignated machine identification is required.The machine identification requirement prohibits copying platform-independent components that are delivered with this product, such as JDBC drivers, to other machines or operating systems unless specifically permitted by this document.Limited-use license for z/OS Application Connectivity to Db2 for z/OSThe z/OS Application Connectivity to Db2 for z/OS feature, a type 4 JDBC driver, is licensed for installation and use solely on z/OS. The sole authorized use of z/OS Application Connectivity to Db2 for z/OS is limited to connecting an application that runs on z/OS to Version 7, 8, 9, 10, or 11 of Db2 forz/OS that is running in a separate partition on the same server as the application is running or on a different z/OS server. You can also connect applications to a subsequent supported version of Db2 forz/OS. Authorized use does not extend to applications that run on Linux or on any other platform or operating system.QMF Enterprise Edition and accompanying program licensesQMF Enterprise Edition Version 11 consists of the following licensed programs:v QMF for TSO/CICSv QMF High Performance Optionv QMF Analytics for TSOv QMF for Workstationv QMF for WebSphereQMF for Workstation and QMF for WebSphere contain third party code that IBM, not the third party, licenses to Licensee under the terms of the IBM Customer Agreement. Notices for the third party code are included for information only. These notices can be found in the Program's NOTICES file(s). Information on how to obtain source code for certain third party code can be found in the Program's NOTICES file(s). Although QMF Version 11 can be used with earlier versions of Db2 for z/OS, you must have a license for Db2 11 to use QMF Version 11 with any supported version of Db2.Redistribution of code for Db2 for z/OSThis document includes information about certain language interface modules that are intended to be bound or otherwise included with code and run on Db2 for z/OS subsystems. In connection with your authorized use of Db2 for z/OS, you may include these language interface modules in your modules and distribute your modules with the included language interface modules for the purposes of developing, using, marketing and distributing programs conforming to the documented programming interfaces for Db2 for z/OS, provided that each language interface module is included in its entirety, including any IBM copyright statements. These language interface modules have not been thoroughly tested under all3conditions. IBM, therefore, cannot guarantee or imply the reliability, serviceability, or function of these language interface modules. The language interface modules referred to here are:v DSNALIv DSNELIv DSNHADD2v DSNHADDRv DSNHLIRv DSNHMVHWv DSNRLIv DSNTIA1v DSNTIARv DSNULIUsage restrictionNot applicable.Type and duration of program servicesIBM Support will be provided until discontinued by IBM with a minimum of six months written notice. Softcopy publicationsExcept as provided in this section, the terms and conditions of the license agreement with IBM apply to the Db2 11 for z/OS Diagnosis Guide and Reference and to any copies that are made from it. This licensed publication can be used on all machines designated for Db2, and can also be copied and used on other machines in support of authorized use of Db2.To support authorized use of Db2, printed copies of the displayable material can be made if the copyright notice and any other legend of ownership is reproduced on each copy or partial copy.WarrantyThis Program is warranted as specified in the IBM license.Licensed Program Specifications may be updated from time to time and such updates may constitute a change in specifications.For Distributed Systems License Option (DSLO) Licenses, warranty service, if any, will be provided only through the Basic License location.Following the discontinuance of all program services, this Program will be provided “As Is” as specified in the IBM license.TrademarksIBM, the IBM logo, and ®are trademarks or registered marks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the web at/legal/copytrade.shtml.Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.4Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both.UNIX is a registered trademark of The Open Group in the United States and other countries.Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates.5IBM®February 2019References in this publication to IBM products, programs, orservices do not imply that IBM intends to make theseavailable in all countries in which IBM operates. Anyreference to an IBM product, program, or service is notintended to state or imply that only IBM's product, program,or service may be used. Any functionally equivalent product,program, or service that does not infringe any of IBM'sintellectual property rights may be used instead of the IBMproduct, program, or service.Any other documentation with respect to this licensedprogram, including any documentation referenced herein, isprovided for reference purposes only and does not extend ormodify these specifications.GC19-4059-04©Copyright IBM Corporation1983,2019US Government Users Restricted Rights—Use,duplicationor disclosure restricted by GSA ADP Schedule Contractwith IBM Corp.Printed in USA。
IBMDB2认证简介

IBMDB2认证简介IBM DB2认证简介作为DB2专业人员,取得IBM DB2认证还是很有必要的,那么,IBM DB2认证是什么呢?下面YJBYS店铺为大家整理了介绍IBM DB2认证的相关信息,希望对你有所帮助。
DB2是什么?DB2拥有悠久的历史并且被很多人认为是最早使用SQL(同样最早被IBM开发)的数据库产品。
DB2这个名字最早被用于数据库管理系统(Database Management System, DBMS)是在1983年当IBM发布基于MVS大型机平台的DB2产品时。
此前,一个叫做SQL/DS的同类产品被应用于VM大型机。
更早期的38系统平台同样也包含一个关系型数据库管理系统。
关系型系统,或者我们称为System R,是一个在70年代开发的检索原型。
DB2可以追朔至70年代初,当时在IBM工作的埃德加·科德(E.F.Codd) 博士描述了关系型数据库理论并在1970年6月发表数据处理模型。
为了应用这个模型Codd需要一种被他称为Alpha的关系型数据库的语言。
那个时候IBM并不相信Codd 想法的潜力,只是把这个项目的实施交给了一个并不在Codd监管之下的程序小组,而这个小组违背了Codd的关系型模型中的一些基础理论;这个项目的实施结果就是Structured English QUEry语言(SEQUEL)。
当IBM公布其第一个关系型数据库产品时,他们希望同样能有一款可用于商业用途的子语言,因此IBM重新开发了 SEQUEL并且命名其为SQL以区别于SEQUEL。
SQL,与流行的看法相反,并不是“依靠允许深层分支打破了面向结构的语言的基本规则”(Allen G. Taylor, 2004)的Structured Query Language的缩写。
这可以引导读者去思考SQL的真正含义。
非常有意思的是,当Informix收购了IIIustra并通过引进他们的Universal Server使他们的数据库引擎成为object-SQL数据库管理系统后,Oracle和IBM跟随着扩展了他们数据库引擎能力从而也能处理关系型对象。
UDB概况

第一章UDB概况提纲:1、UDB的产品家族2、UDB中各组件的功能3、实例(instance)的概念及操作4、UDB变量的设置1.1、UDB的产品家族UDB(Universal Database )的前身为DB2,是IBM公司开发的关系型数据库管理系统。
从其诞生之日开始,DB2就定位于要为各种规模的企业提供稳定、高效的数据管理支持。
可以说,DB2是当前适用范围最广泛的数据库产品。
我们对DB2产品的划分通常分为两种方法:一种方法是按其所能支持的硬件和操作系统平台进行划分,另一种方法是按其所能支持的用户规模的不同进行划分。
DB2产品几乎覆盖了当前所有流行的硬件和操作系统平台。
在大型机操作系统上,有DB2 for OS/390、DB2 for MVS/ESA、DB2 for VSE 和DB2 for VM等多种产品;在由IBM公司设计的小型机AS/400上,DB2已经嵌入在操作系统OS/400之中,成为其不可分割的一部分。
DB2对UNIX操作系统的支持同样十分广泛,可以在AIX、HP-UX、Solaris、SCO-UNIX、SINIX 等多种系统上找到其相应的版本。
另外,在PC操作系统上,DB2可以对Window 9x、Windows NT以及OS/2等多种操作系统提供支持。
UDB 6.1还增加了对Linux操作系统的支持。
以上我们所提到的只是DB2服务器所能运行的平台,DB2的客户端所能支持的平台更为广泛,除了以上提到的所有平台之外,DB2的客户端还能运行在Dos、Windows 3.x、Mac OS以及SGI公司的IRIS系统之上。
最早的 DB2产品是DB2 for MVS/ESA,以后的产品设计时都延续了它的基本结构及关键算法,保障了不同系统之间的可移植性和互操作性。
但是,由于不同操作系统之间存在着不小的差异,DB2系列产品还针对相应的平台进行了一定的优化,以适应操作系统的特性。
UDB产品除了能够对各种硬件和操作系统平台进行支持之外,为了适应不同用户群的需要,UDB提供了不同级别的产品,对小到个人用户,大到跨国企业的不同需求提供支持。
DB2数据库-性能测试监控

建议:根据表的大小设置不同规格(4k、8k、16k、32k)的表空间,将表空间设置为自动增长的方式。
锁配置信息查看
Db2 get db cfg |grep–ilock
获取LOCKTIMEOUT这项指标的值,若为-1表示锁永远不会超时。
当前的应用系统主要分为两类:联机事务处理(OLTP)和联机分析处理(OLAP)。OLTP主要执行日常的事务处理,比如银行存取款、商场购物等,它的主要特点是对响应时间要求高,数据量一般较小,并发多,面向应用。OLAP主要指数据仓库、决策分析类系统,主要特点是数据量大,对实时性要求不高,面向主题。
针对这两种典型的系统,DB2提供了很好的支持。对于OLTP系统和数据量较小的OLAP系统,可以采用单分区架构。
数据库排序溢出总次数
SQL_Current
数据库当前执行的SQL语句
Tb_scan
数据库全表扫描的情况
Num_SQ_execut
执行次数较多的SQL
Package_Cache_Ratio
包缓存命中率
LOCK_SQL
造成数据库锁的SQL
Hight_CPU_TIME_SQL
最消耗系统资源的SQL
四
根据DB2监控指标中列出的指标名称,按测试指南指标、其他常用指标逐一给出详细的监控方法。
Db2wdong
DB2的看门狗,是db2sysc的父进程。如果db2sysc集成非正常终止,它将清除所占用的资源。
Db2vend
在主进程之外的围栏进程,所有db29.5的第三方代码都在这个进程中运行。
Db2fmp
围栏进程,在防火墙外运行用户的存储程序和用户定义函数代码。此进程代替了db2老版本中的db2udf和db2dari进程。
DB2基础知识(一)

内部资料 注意保密
12
二、DB2的访问
节点目录、系统数据库目录和本地数据库目录间关系
内部资料 注意保密
13
二、DB2的访问
2.1 DB2的登录
通过本地客户端链接DB2服务器
内部资料 注意保密
14
二、DB2的访问
2.2 SQL语句的执行
内部资料 注意保密
15
二、DB2的访问
2.3 SQLSTATE & SQLCODE
说明
– – –
不能修改视图 视图不能创建索引 如果删除了某视图基于的表或另一视图,则该视图在数据库虽然有定义但不起作用
内部资料 注意保密
35
三、DB2数据库对象
视图
创建可更新视图和只读视图
• • •
视图的 SELECT 语句决定视图是只读的还是可更新的 通常,如果视图的行可映射至基表的行,则视图是可更新的。
显式地指定对象的模式名: create table DWAINE.table1 (c1 int, c2 int) 隐式地指定对象的模式名: create table t2 (c1 int) --- table tjadm.t2 created 注:隐式地指定对象的模式名,用户 需要IMPLICT_SCHEMA 特权
内部资料 注意保密
11
二、DB2的访问
2.1 DB2的登录
通过本地客户端链接DB2服务器
安装本地DB2客户端程序 配置本地Catalog(编目)
Db2cmd->db2 connect to bidbdw user scvadm
catalog tcpip node mynode remote 99.1.57.103 server 50000; catalog db bidbdw at node mynode;
1、DB2环境配置说明

DB2环境配置说明1、安装DB2客户端:(源程序在192.168.71.244上)安装完成后在本地程序中选择:IBM DB2->设置工具->配置助手选择:使用向导来添加数据库选择“搜索网络”或“手工配置网络的连接”;我们选择“手工配置网络的连接”选择“TCP/IP”主机名:192.168.71.244服务名称:可以不写端口号:50000点击“下一步”数据库名称:lissleb点击“下一步”选中“为ODBC注册此数据库”点击“下一步”这样在配置助手中就显示出刚才配置的数据库名称选中“LISSLEB”右击选择“CLI设置”用户标示:db2admin密码:lisserver点击确定。
选中“LISSLEB”右击选择“测试连接”输入密码,如果测试成功,则说明已经连接成功,可以正常使用2、配置PowerBuilder点击上面的DB Profile快捷按钮选中:ODB ODBC 点击“NEW”在Profile Name中输入“lissleb”Data Souce 选择“LISSLEB”User ID :db2adminPassword:lisserver点击“OK”即可这时在“ODB ODBC”下面显示了“lissleb”,选中点击Connect,连接成功即可然后在下图中选择DataBase快捷按钮便可以正常使用3、系统连接设置:在vss上得到最新的Lis/Utility/JdbcUrl.java或修改为/*** 光大永明渠道管理系统数据库- 开发使用*/DBType = "DB2";IP = "192.168.71.244";Port = "50000";DBName = "LISSLEB";UserName = "db2admin";PassWord = "lisserver";Lis/Utility/DBConn.javaLis/Sys/SysConst.javaUi/logon/station.jsp文件然后整体编译java类连接配置成功:可能会出现下面的问题一:在点击菜单时出现如下错误得到最新的Ui/logon/ station.jsp文件即可二:在系统使用的过程中可能在涉及到查询时不能查询到有效数据,这是看tomca 后台,会发现SQL执行错误。
db2常用命令(详解)大全

db2常⽤命令(详解)⼤全近⼀年来在项⽬开发中使⽤到了IBM的DB2 9.1的数据库产品,跟Oracle相⽐⼀些命令有很⼤的区别,⽽它最⼤的功能是⽀持xml存储、检索机制,通过XPath进⾏解析操作,使开发⼈员免于对xml⽂件在应⽤进⾏解析处理,先对其常⽤命令进⾏⼀下汇总,以免遗忘。
注意:在执⾏如下命令时,需要⾸先安装db2客户端并通过在运⾏中输⼊db2cmd进⾏初始化⼀、基础篇1、db2 connect to <数据库名> --连接到本地数据库名db2 connect to <数据库名> user <⽤户名> using <密码> --连接到远端数据库2、 db2 force application all --强迫所有应⽤断开数据库连接3、db2 backup db db2name<数据库名称> --备份整个数据库数据db2 restore db <db2name> --还原数据库4、db2 list application --查看所有连接(需要连接到具体数据库才能查看)5、db2start --启动数据库db2stop --停⽌数据库6、create database <数据库名> using codeset utf-8 territory CN--创建数据库使⽤utf-8编码7、db2 catalog 命令db2 catalog tcpip node <接点名称> remote <远程数据库地址> server <端⼝号>--把远程数据库映射到本地接点⼀般为50000db2 catalog db <远程数据库名称> as <接点名称> at node PUB11--远程数据库名称到本地接点db2 CONNECT TO <接点名称> user <⽤户名> using <密码>--连接本地接点访问远程数据库8、数据库导出db2look -d <数据库名> -u <⽤户> -e -o <脚本名称>.sql--导出数据库的表结构,其中⽤户空间⼀般为db2admin/db2inst1db2look -d <数据库名> -u <⽤户> -t <表1> <表2> -e -o <脚本名称>.sql--导出数据库中表1和表2的表结构db2move <数据库名> export --导出数据库数据db2move <数据库名> export -tn <表1>,<表2> --导出数据库中表和表数据 db2move dbname export;db2move dbname import db2move bipdbrun export -sn app -u app -p app9、数据库导⼊db2 -tvf <脚本名称>.sql --把上述导出的表结构导⼊到数据库表结构db2move <数据库名> load -lo replace --把上述“db2move <数据库名> export“导出的数据导⼊到数据库中并把相同的数据替换掉在实际使⽤过程中,如果⽤到db2⾃增主键,需要使⽤by default,⽽不是always,功能是⼀样的,但这样在数据移植时候会很⽅便!10、db2 connect reset 或 db2 terminate --断开与数据库的连接11、db2set db2codepage=1208 --修改页编码为120812、db2 describe table <表名> --查看表结构13、db2 list tables --查看数据库中所有表结构list tables for system --列出所有系统表14、db2 list tablespaces --列出表空间⼆、⾼级篇15、fetch first 10 rows only --列出表中前10条数据例如:select * from <表名> fetch first 10 rows only16、coalesce(字段名,转换后的值) --对是null的字段进⾏值转换例如:select coalesce(id,1) from <表名> --对表中id如果为null转换成117、dayofweek(⽇期) --计算出⽇期中是周⼏(1是周⽇,2是周⼀.......7是周六)dayofweek_iso --计算出⽇期中是周⼏(1是周⼀.......7是周⽇)例如:dayofweek(date(2008-01-16)) --它会返回是4,代表星期三dayofweek_iso(date(2008-01-16)) --它会返回是3,代表星期三18、dayofyear(⽇期) --⼀年中的第⼏天,范围在1-366范围之内注意:参数中⽇期的格式是YYYY-MM-DD的形式,如果不是需要进⾏转换,否则函数不能使⽤例如:⽇期是20080116必须要进⾏转换dayofweek(concat(concat(concat(substr(openDate,1,4),'-'),concat(substr(openDate,5,2),'-')),substr(openDate,7,2)))as week)这样格式正确的。
DB2数据库培训教材

Copyright © 2006 Sihitech Co. - All Rights Reserved
北京宇信鸿泰软件技术有限公司
DB2 安装
选择“下一步”。
Copyright © 2006 Sihitech Co. - All Rights Reserved
北京宇信鸿泰软件技术有限公司
DB2 安装
Copyright © 2006 Sihitech Co. - All Rights Reserved
北京宇信鸿泰软件技术有限公司
恢复数据库到本地
从开始菜单上选择“开始->IBM DB2->命令行工具->命令窗 口”,并切换到E:\crmdb目录下。 执行“db2 -tf crmcs_rr2.sql”。
北京宇信鸿泰软件技术有限公司
DB2 概述
DB2是IBM公司的一个关系型数据库产品。 DB2可以运行在AS400、S390、UNIX、Windows等平台上。 DB2的手册、参考等文档可以从IBM的官方网站下载。 在建行OCRM项目中,因为该项目所使用工作流软件S1的原 因,数据库产品选择了DB2。
北京宇信鸿泰软件技术有限公司
DB2 安装
接受默认值。选择“下一步”。
Copyright © 2006 Sihitech Co. - All Rights Reserved
北京宇信鸿泰软件技术有限公司
DB2 安装
接受默认值。选择“下一步”。
Copyright © 2006 Sihitech Co. - All Rights Reserved
北京宇信鸿泰软件技术有限公司
DB2 安装
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
IBM DB2 Connect 简介: 内有乾坤2005 年 4 月对于那些脱离大型机的应用程序——分布式应用程序来说,IBM® DB2® Connect™ 已成为向它们开放 DB2 for z/OS 数据库以及 zSeries 硬件平台传统公认的所有优点的首选方法。
本文是一个由 5 部分组成的系列中的第一篇文章,这个系列将介绍 DB2 Connect 的一些主要特性,这些特性有助于提高交付随需应变解决方案的能力。
简介1993 年,计算机界的专家们预测大型机(mainframe)将迅速退出历史舞台。
他们宣称,未来的计算基础设施将会是一个高度分布的、松散连接的个人电脑和客户机-服务器系统的集合。
作为该行业的相关参与者,IBM 几乎无立身之处。
我们都知道后来是怎么回事。
IBM 设法在分布式市场重新占得先机,并成为大型机(mainframe)技术的“主要”支持力量。
从价格的角度来看,IBM 大大缩减了大型机的价格。
从技术的角度来看,IBM 放弃了为其大型机提供动力的双极技术(bi-polar technology),而将大量赌注放在 CMOS 芯片技术上,试图通过这种方式,以剧减的价格交付大型机级别的计算。
更重要的是,对于所谓大型机是一种过时的技术,属于大型机的时代已经一去不复返这类荒诞的说法,这是一个直接有力的反击。
如今,企业比以前更多地使用大型机作为其计算基础设施的基础。
与此同时,Linux™、UNIX®、Windows® 和其他客户机-服务器系统(在此处被称作分布式平台)并没有消失,因为大型机又重新为它们在企业中赢得了地位。
实际上,这些分布式计算基础设施经历了一个发展的过程。
最终的结果是,客户希望将分布式平台的简单性和长处与大型机技术无可匹敌的强大性相结合。
如果说信息技术(IT)中有一个领域能让这种结合产生立杆见影的效果,那么这个领域一定是数据库应用领域。
IBM DB2 Universal Database™ for z/OS (DB2 for z/OS) 原本是一种大型机数据库,现在已转型为世界上第一种用于客户机-服务器应用程序的数据库服务器。
在如今的数据中心里,当您使用运行在大型机上的 CICS 或 COBOL 应用程序时,很可能会遇到 DB2 for z/OS 被用作运行在 Windows、UNIX 和 Linux 上的应用程序的数据库服务器的情况。
正是在这种环境下,我发现 IBM DB2 Connect (DB2 Connect) 产品扮演着一个中心角色。
如今,对于那些脱离大型机的应用程序——分布式应用程序来说,DB2 Connect 已成为向它们开放 DB2 for z/OS 数据库和 zSeries 硬件平台的所有传统公认优点的事实上的首选。
为什么当其他产品遭遇失败的时候,DB2 Connect 却能获得成功呢?这个关于DB2 Connect 的系列试图描述 DB2 Connect 的一些关键特性,我们相信正是这些特性使得它不同于其竞争解决方案。
例如,大多数客户都喜欢由单独一个供应商提供的解决方案,因为这样一来,他们只需跟一个地方联系就可以获得支持:可以说是“one neck to choke”。
另外一些客户喜欢 DB2 Connect 的理由是,它来自像 IBM 这样长时间靠得住的大供应商(在连接领域,很多供应商来来去去,或者改换名称)。
在这个系列的文章中,我们将把焦点放在 DB2 Connect 解决方案的技术方面,而把非技术方面的东西留给 IBM 销售人员去解决。
这是一个由 5 部分组成的系列中的第一篇文章,这个系列将向您介绍 DB2 Connect 的一些主要特性,利用这些特性可以大大提高交付随需应变解决方案的能力。
本文的重点不是讨论 DB2 Connect 的打包和许可。
这方面的信息可以参考 Paul C Zikopoulos 和 Leon Katsnelson 合著的哪个版本的 DB2 Connect 适合您?。
DB2 Connect 是什么?本系列概述为了真正理解 DB2 Connect 是什么,也许先告诉您它不是什么要容易一些。
在DB2 Connect 的发展前期,也就是 Distributed Database Connection Server (DDCS) 时期,很多人在描述这个产品的时候,说它是将分布式平台上的 DB2 数据库连接到大型机上的 DB2 数据库的一种方式。
所以让我们首先澄清一点: DB2 Connect 不做那样的事,我们也不知道有哪个产品会像前面所描述的那样“将数据库连接在一起”。
DB2 Connect 存在的目的是将应用程序连接到数据,而不是将一个数据库连接到另一个数据库。
那么,在 DB2 Connect 的上下文中,什么是数据库,什么是应用程序呢?在 IT 界,当我们在一个较高的层次谈论应用程序时,我们通常指的是一个系统或一组系统,它可以帮助我们交付业务解决方案。
例如,我们会谈到 CRM 或 ERP 应用程序。
在讨论 DB2 Connect 时,我们需要在更窄的定义内使用应用程序这个词。
在这个系列的文章中,当我们提到应用程序时,我们谈论的就是整个大应用程序中的一个部分。
更确切地说,我们指的是实现用户界面(UI)和业务逻辑(以及如何让它们访问所请求的数据)的应用程序代码。
换句话说,在这个系列中,当我们说到应用程序时,我们指的是发出针对数据库的查询、处理结果、调用将更改数据库中数据的事务这样一些实际的代码。
例如,一个被连接到 Siebel CRM 应用程序的Microsoft® Excel 电子表格(这个 Siebel CRM 应用程序运行在Windows 服务器上,并与 DB2 相连接),或者运行在一个Linux WebSphere® 服务器上的一组 JSP 和Java™ Bean,它们都属于我们在这几篇关于 DB2 Connect 的文章中所说的应用程序。
注意,上面那些例子指的是不在 z/OS 操作系统控制下运行的计算机代码。
实际上,我们说的是在 Windows、Linux 等系统控制下运行的计算机代码。
这正是 DB2 Connect 的精髓。
它允许从运行在其他平台(Linux、UNIX 和 Windows)上的计算机代码访问在OS/390®、z/OS、i5/OS™、OS/400®、VSE 和 VM 控制下运行的DB2 服务器。
虽然 DB2 Connect 可以连接到所有这些平台上的数据库服务器,但我们主要讨论将应用程序连接到在 z/OS 控制下运行的 DB2。
图 1 描绘出DB2 Connect 的真正工作。
图 1. DB2 Connect 为运行在分布式平台上的应用程序提供一种使用大型机管理的数据的机制图 1. DB2 Connect 为运行在分布式平台上的应用程序提供一种使用大型机管理的数据的机制用 DB2 Connect 将代码连接到数据所以,DB2 Connect 是一个中间件,用于将应用程序代码连接到数据。
那么,它是怎么做到这一点的呢?当您编写与关系数据库(例如 DB2)交互的计算机代码时,必须考虑两个关键要素。
首先,需要选择一种用于与数据库交互的语言。
通常这种语言是 SQL。
其次,还需要选择一种应用程序编程接口(API),此 API 可以将那种语言和您的 SQL 发送到数据库进行处理。
任何与 DB2 打过交道的人都知道,DB2 支持很多有特色的、功能强大的 SQL 语言。
在与 DB2 Connect 一起使用 SQL 时,实际上就是在使用您很可能在其他应用程序中用到的同一种 SQL。
DB2 Connect 只是将 SQL 从应用程序传递到 DB2 数据库进行处理。
它不会重写 SQL,也不会以任何方式更改 SQL。
换句话说,如果您能熟练地构建 SQL 应用程序,那么就也能够编写分布式平台上的 SQL 应用程序,并让这些应用程序使用大型机上的 DB2。
因为 SQL 的实现在整个 DB2 家族的数据库服务器之间都能很好地兼容,所以这些应用程序还可以使用其他平台上的 DB2 服务器。
但是,用 C、Java 或 Visual 编写应用程序的程序员如何将 SQL 提交给 DB2,以便进行处理呢?别忘了,这些编程语言都完全不了解 SQL。
于是 API 就派上用场了。
所有现代编程语言都支持用于将 SQL 提交给关系数据库的 API。
熟悉大型机 SQL 编程的程序员对嵌入式 SQL 应该不会感到陌生。
嵌入式 SQL 也是 DB2 Connect 支持的一种 API。
分布式计算领域中出现的其他一些更流行的基于 SQL 的 API 有:DB2 CLI、ODBC、OLE DB、ADO、、JDBC 和 SQLJ。
DB2 Connect 支持所有这些 API。
这意味着,为 Linux、UNIX、Windows 和其他分布式平台(例如 Mac 操作系统,当我们讨论 Java 时会详细谈到)编写代码的应用程序编程人员,可以用某种方式将 SQL 提交给 DB2,以便进行处理。
而且,他们可以用自己选择的语言来开发他们的应用程序代码,例如 Java、Visual 、C#、COBOL、C++,等等。
我们大多数人都听说过 ODBC、JDBC 和其他一些类似的接口,它们被称作驱动程序。
虽然我们经常听到 ODBC 驱动程序这种说法,但这不完全等同于术语 ODBC API(而且也不应该那样去解释)。
其他接口也一样。
例如,ODBC API 是一组函数调用的一种规范,程序员可以对数据库进行这些函数调用。
例如,C 程序员会调用 SQLExec 函数将要执行的一条 SQL 语句发送到一个关系数据库管理系统。
而 SQLExec 函数和其他 ODBC API 是由 ODBC 驱动程序来实现的。
DB2 Connect 驱动程序DB2 Connect 提供了实现前一段话中提到的所有 API 的驱动程序。
然而,并不是所有 API 都是用驱动程序实现的。
例如,嵌入式 SQL是通过一个预编译器实现的,这个预编译器读取 C 或 COBOL 源代码,并用 C 或 COBOL 编译器能够理解的 C 或 COBOL 函数调用替换 SQL 调用。
这些函数被实现为 DB2 Connect 所提供的一部分库。
有些 API 由相同的驱动程序实现,对于有些 API,可以由多种驱动程序来实现(例如 JDBC)。
表 1 总结了不同的 API 和 DB2 Connect 附带的驱动程序。
表 1. DB2 Connect 附带的 API 和驱动程序表 1. DB2 Connect 附带的API 和驱动程序由于 DB2 Connect 提供了这么广泛的驱动程序,这很可能会导致有人再次对DB2 Connect 的本质产生误解:人们常常相信,DB2 Connect 只是一个驱动程序包,这个产品的功能只有这些。