科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网软件频道XML无处不在——DB2 9给予你掌握它的力量

XML无处不在——DB2 9给予你掌握它的力量

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

IBM最新的数据库,IBM DB2 9,引入了pureXML,一个解决使用XML进行工作的压力的本地XML特性集合。从新的XML数据类型到XQuery语言,DB2 9使得XML开发变得更加容易。

作者:Duane Merrill 来源:论坛整理 2007年12月24日

关键字: DB2

  • 评论
  • 分享微博
  • 分享邮件

在本页阅读全文(共8页)

引入AJAXDEMO数据库

  你将创建两个表,一个有XML域,一个没有。你可以通过各种方式来操作,如通过控制中心。但是为了展示的目的,打开VS2005,创建一个新的ASP.NET站点“Superpals”,如图5和6.将“Visual C#”作为开发语言。

Superpals


db2



  为了测试你的新Web易用,在Default.aspx的<div>标记中间键入一些文字并运行。当一切正常,结束运行返回IDE。在工具菜单下寻找“IBM DB2 Tools”。图7.你可以通过这个菜单来访问你的DB2 产品,就像你打开开始菜单一样。选择工具-> IBM DB2 Tools->命令编辑器来打开查询窗口。

IBM DB2 Tools



  拷贝List1 中的代码到查询窗口。

CONNECT TO AJAXDEMO;

------------------------------------------------
-- DDL Statements for table "NULLID "."HEROES_NOXML"
------------------------------------------------


CREATE TABLE "NULLID "."HEROES_NOXML" (
"HEROID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (
START WITH +1
INCREMENT BY +1
MINVALUE +1
MAXVALUE +2147483647
NO CYCLE
NO CACHE
NO ORDER ) ,
"HERONAME" VARCHAR(50) NOT NULL ,
"POWER" VARCHAR(255) ,
"WEAKNESS" VARCHAR(255) ,
"NOTES" CLOB(1048576) LOGGED NOT COMPACT )
IN "USERSPACE1" ;

 

-- DDL Statements for primary key on Table "NULLID "."HEROES_NOXML"

ALTER TABLE "NULLID "."HEROES_NOXML"
ADD CONSTRAINT "CC1158547603783" PRIMARY KEY
("HEROID");

------------------------------------------------
-- DDL Statements for table "NULLID "."HEROES_XML"
------------------------------------------------


CREATE TABLE "NULLID "."HEROES_XML" (
"HEROID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (
START WITH +1
INCREMENT BY +1
MINVALUE +1
MAXVALUE +2147483647
NO CYCLE
NO CACHE
NO ORDER ) ,
"HERONAME" VARCHAR(50) NOT NULL ,
"NOTES" XML )
IN "USERSPACE1" ;

 

-- DDL Statements for primary key on Table "NULLID "."HEROES_XML"

ALTER TABLE "NULLID "."HEROES_XML"
ADD CONSTRAINT "CC1158547736768" PRIMARY KEY
("HEROID");

COMMIT WORK;

CONNECT RESET;

TERMINATE;
This creates the following two tables:
HEROES_NOXML:
HEROID, INTEGER (4), IDENTITY, NOT NULLABLE
HERONAME, VARCHAR (50), NOT NULLABLE
POWER, VARCHAR (255), NULLABLE
WEAKNESS, VARCHAR (255), NULLABLE
NOTES, CLOB, NULLABLE
HEROES_XML:
HEROID, INTEGER (4), IDENTITY, NOT NULLABLE
HERONAME, VARCHAR (50), NOT NULLABLE
NOTES, XML, NULLABLE
Populate the first table by copying the SQL code from Listing 2 into your Command Editor.
Listing 2: HEROES_NOXML Data
INSERT INTO NULLID.HEROES_NOXML
(HERONAME, POWER, NOTES)
VALUES ('Mockingbird','Can mimic any sound she hears.','Alter ego:
Mariah Carey');

INSERT INTO NULLID.HEROES_NOXML
(HERONAME, POWER, WEAKNESS, NOTES)
VALUES ('Indigo','Telepathy','Gets cranky if he stays up too late.','Current age: 8.
Additional weakness: lactose intolerant.');

INSERT INTO NULLID.HEROES_NOXML
(HERONAME, POWER, WEAKNESS, NOTES)
VALUES ('Indivisibull','Super strength; can reattach severed body
parts.','Not too bright.','Secret origin: a somewhat clumsy man,
Hank "Bullhead" Durham fell into a vat of fresh glue
and was promptly struck by lightning. Since then, whenever he
loses a limb, he has simply to hold it in place and the limb becomes reattached.');

INSERT INTO NULLID.HEROES_NOXML
(HERONAME, POWER, WEAKNESS, NOTES)
VALUES ('Dayglo','Glows under a black light.','Not having a black light around.','Usually
relegated to sidekick, though once played a crucial role in a mission busting an
underground pot growers cabal.');

INSERT INTO NULLID.HEROES_NOXML
(HERONAME, POWER, WEAKNESS, NOTES)
VALUES ('Thumbalina','Ability to text message at light speed.','Thumbsucking
(a nervous habit in times of great stress).','Former codename: Twiddle.');

  下面我们学习如何在VS2005中使用DB2 9插件来创建一个web服务,和异步的JavaScript交互。
    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章