简体   繁体   English

使用Java在XML文件中将database(DB2)元组作为XML元素插入?

[英]insert database(DB2) tuples as XML elements in XML file using java?

how to insert database(DB2) tuples as XML elements in XML file using java? 如何使用Java在XML文件中将数据库(DB2)元组作为XML元素插入? Is there any possibility to retrieve XML elements which were entered earlier as database tuples?? 是否有可能检索先前作为数据库元组输入的XML元素? or can they be used to provide a view customized to different users. 或者可以使用它们为不同的用户提供定制的视图。

Although it would help to see a bit of an example of what you're trying to accomplish, I am fairly certain that a couple of different XML features in DB2 (referred to collectively as pureXML) can help your application convert smoothly between XML documents and relational data. 尽管可以看一下您要完成的工作的示例,但我可以肯定地说,DB2中的几个不同的XML功能(统称为pureXML)可以帮助您的应用程序在XML文档和关系数据。

Publishing tuples/rows as XML is done with SQL/XML functions such as XMLELEMENT, XMLATTRIBUTE, XMLFOREST, XMLAGG, and XMLSERIALIZE, to name a few. 仅举几例,使用SQL / XML函数(例如XMLELEMENT,XMLATTRIBUTE,XMLFOREST,XMLAGG和XMLSERIALIZE)完成以XML形式发布元组/行。 These functions have been available since DB2 V8.1, when they were introduced as part of the SQL:2003 spec. 自DB2 V8.1作为SQL:2003规范的一部分引入以来,这些功能就已经可用。 Other DBMS vendors support these functions in their products, too. 其他DBMS供应商也在其产品中支持这些功能。 To produce more sophisticated XML constructs, such as hierarchical data relationships and repeating elements, you will probably want to exploit common table expressions that use XMLAGG or XMLGROUP. 为了生成更复杂的XML结构,例如层次结构数据关系和重复元素,您可能需要利用XMLAGG或XMLGROUP的常用表表达式。

XML data can be stored natively in DB2 v9.1 and newer by using the XML datatype, which produces a column that accepts any well-formed XML input. 可以使用XML数据类型将XML数据本地存储在DB2 v9.1和更高版本中,该XML数据类型产生一列,该列可以接受任何格式正确的XML输入。 If you instead want to decompose/shred the inbound XML into one or more columns of a relational table, the XMLTABLE function takes in an XML document and your XPath expressions to convert the relevant nodes into a traditional result set that can be referenced by a SQL insert statement. 相反,如果您想将入站XML分解/分解为关系表的一个或多个列,则XMLTABLE函数将获取XML文档和XPath表达式以将相关节点转换为SQL可以引用的传统结果集插入语句。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM