DB2 外部表?

发布于 2025-01-07 18:43:37 字数 466 浏览 8 评论 0原文

我刚刚听说 Oracle 有一个称为外部表的功能,允许从数据库访问平面文件(例如文件系统中的 CSV 文件)。

我只是想知道DB2 for LUW 中是否有类似的东西。

我能看到的最接近的事情是实现一个 Table 函数(例如,用 Java 编写),该函数将读取文件,并返回包含文件中数据的表。然而,这个过程需要很长时间(创建 Java 代码、编译 Java 并在 DB2 中创建关联 Java 类的函数),并且对于具有不同列数的不同文件来说,实现不是动态的(表函数返回一组预定义的数据)。列)。

这里是Oracle外部表的文档: http://docs.oracle .com/cd/B28359_01/server.111/b28319/et_concepts.htm

I just heard that Oracle has a feature called External Table that allows to access a flat file (for example a CSV file in the file system) from the database.

I just want to know if there is something similar in DB2 for LUW.

The closest thing I could see is to implement a Table function (written in Java, for example) that will read the file, and return a table with the data from the file. However, this procedure takes a long time (create the Java code, compile the Java and create the function in DB2 associating the Java class) and the implementation is not dynamic for different files with different quantity of columns (table function returns a predefined set of columns).

Here the documentation of Oracle External Tables: http://docs.oracle.com/cd/B28359_01/server.111/b28319/et_concepts.htm

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

路还长,别太狂 2025-01-14 18:43:37

是的,IBM 将其作为 InfoSphere Federation Server 的一部分提供,它基本上允许您在数据库内定义各种数据源的昵称。 支持的数据源

Yes, IBM offers this as part of their InfoSphere Federation Server, which basically allows you to define nicknames inside a database to various data sources. Supported data sources

心的位置 2025-01-14 18:43:37

IBM Db2 11.5 支持外部表,允许您执行此操作。

此功能以前仅由 Netezza 提供,现在 Db2 也已采用此功能。

请参阅此处的 CREATE EXTERNAL TABLE 手册页 https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.5.0/com.ibm.db2.luw.sql.ref.doc/doc/r_create_ext_table.html

IBM Db2 11.5 has support for external tables that will allow you to do this.

This was formerly provided only by Netezza and this functionality has made its way to Db2.

See the manual page for CREATE EXTERNAL TABLE here https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.5.0/com.ibm.db2.luw.sql.ref.doc/doc/r_create_ext_table.html

困倦 2025-01-14 18:43:37

如前所述,InfoSphere Federation Server 是一个不错的选择。 DB2 UDB(通用数据库)有两种替代方案,这在特定用例中可能会有所帮助:

  • DataLinks:它基本上是另一种数据类型
    它保留对您的外部文件的引用。它还提供
    对外部数据(例如参考数据)的多个级别的控制
    完整性、访问控制、协调的备份和恢复,以及
    交易一致性。
  • DB2 Extenders:它们扩展了 DB2 的功能以操作特定的文件格式,例如 XML Extender 提供了一组功能来操作 DB2 内的 XML 文件

As mentioned, InfoSphere Federation Server is a good choice. There are two alternatives for DB2 UDB (Universal Database), which may be helpful in specific use cases:

  • DataLinks: it is basically another data type
    that keeps a reference to your external file. It also provides
    several levels of control over external data such as referential
    integrity, access control, coordinated backup and recovery, and
    transaction consistency.
  • DB2 Extenders: they extend functionality of the DB2 to operate on specific file formats, e.g. XML Extender provide set of features to operate on XML files inside DB2
╭ゆ眷念 2025-01-14 18:43:37

还有:
(a) 仓储引擎产品(Db2 Warehouse、Db2 Warehouse on Cloud)中的外部表支持 (b) 所有可实现相同功能的 Db2 产品中的数据虚拟化(又名联合/流体查询)。

There is also:
(a) external table support in the warehousing engine products (Db2 Warehouse, Db2 Warehouse on Cloud) (b) Data virtualization (aka federation/fluid query) in all Db2 products which may achieve the same thing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文