简述
DB2数据库使用DRDA协议,DRDA是一个跨IBM平台访问、遵循SQL标准的数据库信息标准。它是IBM的信息仓库框架中的重要组成部分,该框架定义了庞大的后台服务器,客户机可通过较小的基于工作组的中介服务器来访问它,DRDA具有下列功能:
提供了IBM的DB2、DBM、SQL/DS和SQL/400数据库系统的互连框架;
支持多供应商提供的数据库系统;
DRDA是IBM环境中建立客户机/服务器计算的基础之一。其它基础是高级的对等联网(APPN)和分布式数据管理(DDM)。通过信息仓库和DRDA,IBM计算机将它的企业中心组成部分的大型计算机,用作各种类型信息(包括多媒体信息)的存储平台。
报文结构
DRDA报文
DRDA利用TCP传输数据:
通常一个DRDA报文中可以包含一个或者多个DRDA数据结构。
DRDA结构
一个DRDA结构包含一个DDM头:
Length:单个DRDA的长度
Magic: 0xD0
Format: 0x02 Reply Message
0x03 Object Response
0x42 Chained Reply Message, same RC
0x52 Chained Reply Message, different RC
0x53 Chained Object Message, same RC
CorrelID:连接的ID
Length2:Length减去Magic、Format、CorrelID后的长度
Code point: DDM Term Code
数据区可以是Parameters结构,也可以直接用字节流.
Parameters格式如下图:
报文结构格式如下图:
字节码结构如下图:
Length: Parameter的长度
Code point:描述这个数据的用途
Data :数据
字节流如下图:
常用DDM列表
DDM Term | Term Title |
Connection establishment to a remote database manager | |
EXCSAT | Exchange server attributes |
ACCRDB | Access RDB |
Package creation/rebind/remove | |
BGNBND | Begin binding of a package to an RDB |
BNDSQLSTT | Bind SQL Statement to an RDB package |
ENDBND | End binding of a package to an RDB |
REBIND | Rebind an existing RDB package |
DRPPKG | DROP a package at an RDB |
Query Processing | |
OPNQRY | Open query |
CNTQRY | Continue query |
CLSQRY | Close query |
Prepare/describe/execute SQL statements | |
PRPSQLSTT | Prepare SQL statement |
DSCSQLSTT | Describe SQL statement |
DSCRDBTBL | Describe RDB table |
EXCSQLSTT | Execute SQL statement |
EXCSQLIMM | Execute immediate SQL statement |
Commit/rollback unit of work | |
RDBCMM | RDB commit unit of work used by RUOW connections |
RDBRLLBCK | RDB rollback unit of work used by RUOW connections |
SYNCCTL | Sync point control request used for DUOW connections |
SYNCRSY | Sync point resynchronization request used by DUOW connections |
Security processing | |
ACCSEC | Access security |
SECCHK | Security check |
Propagating special register settings | |
EXCSQLSET | SET SQL environment |
Connection establishment to a remote database manager | |
EXCSAT | Exchange server attributes |
ACCRDB | Access RDB |
DDM Reply Data Objects Used by DRDA
DDM Term | Term Title |
ACCRDBRM | Access to RDB completed |
ACCSECRD | Access security reply data |
CMDCMPRM | Command processing completed |
ENDQRYRM | End of query condition |
ENDUOWRM | End unit of work condition |
EXCSATRD | Server attributes reply data |
OPNQRYRM | Open query complete |
QRYDSC | Query answer set description |
QRYDTAQ | Query answer set data |
RDBUPDRM | Update at an RDB condition (Introduced in DRDA Level 2) |
RSLSETRM | RDB result set reply message |
SECCHKRM | Security check complete reply message |
SECTKN | Security token reply data |
SQLCARD | SQL communications area reply data |
SQLCINRD | SQL result set column info reply data |
SQLDARD | SQLDA reply data |
SQLDTARD | SQL data reply data |
SQLRSLRD | SQL result set reply data |
SYNCCRD | Sync point control reply data in support of distributed unit of work |
SYNCRRD | Sync point resynchronization reply data in support of distributed unit of work |
SYNCLOG | Identifies the sync point log used for a unit of work |
TYPDEFNAM | Data type definition name |
TYPDEFOVR | Data type definition override |
常用Parameter
Parameter Term | Term Title | Term Value of Test |
EXTNAM | External Name | db2bp |
SRVCLSNM | Server Class Name | DB2/LINUXX8664 |
SRVNAM | Server Name | localhost.localdomain |
SRVRLSLV | Server Product Release Level | SQL09077 |
SEMMEC | Security Mechnism | 0x0009 |
RDBNAM | Relational Database Name | SNDBADB1 |
SECTKN | Security Token | Hex String |
MGRLVLLS | Manage Level List | Hex String |
SECCHKCD | Security Check Code | 0x01 |
USRID | User ID at The Target System | sndbains |
CRRTKN | Correlation Token | 192.168.85.30.39881.19055161113048 |
PRDID | Product-Specific Identifier | SQL09077 |
TYPDEFNAM | Data Type Definition Name | QTDSQLX86 |
PKGNAMCSN | RDB Package Name, Consistency Token and Section Number |
|