DB2 外部表?
我刚刚听说 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,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
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.htmlIBM 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如前所述,InfoSphere Federation Server 是一个不错的选择。 DB2 UDB(通用数据库)有两种替代方案,这在特定用例中可能会有所帮助:
它保留对您的外部文件的引用。它还提供
对外部数据(例如参考数据)的多个级别的控制
完整性、访问控制、协调的备份和恢复,以及
交易一致性。
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:
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.
还有:
(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.