使用db2配置mysql链接服务器 [英] Configuring mysql linked server with db2

查看:256
本文介绍了使用db2配置mysql链接服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个数据库服务器一个是mysql另一个是db2都在不同的机器上运行。我想通过使用join.i从数据库的表中获取记录,研究了关于链接服务器的概念,但问题是我couldnt找到任何使用db2创建链接服务器的示例(我可以找到是SSMS,即使用Sql Server Mannagement Studio创建链接服务器),但是我的情况是mysql和db2,我需要创建一个链接的服务器到其中一个/



请建议一些帮助,如何实现这一点。



提前感谢!

解决方案

在DB2中,有一个名为 federation (信息集成的一部分)的功能,你向DB2呈现外部资源(包装和昵称);您可以从DB2查询这些外部资源,甚至可以在不同来源之间进行连接(其他DB2数据库,Informix | MSSQL服务器| Oracle | MySQL数据库,平面文件等)
为了查询外部资源,此功能需要特殊许可证。相反,如果要查询其他DB2或informix数据库,则此功能不会请求额外的许可证,因为它是免费的(这些是IBM数据库)。



有一个名为表函数的选项。这些函数在调用时返回一个表,然后可以将返回的数据与其他表相加。这些功能可以在SQL PL(IBM过程语言),C或Java中开发。



使用第二个选项,您可以在Java中创建一个表函数, MySQL表,然后将数据返回给DB2。
我已经写了一个关于如何在Twitter中查询主题的示例,并将该数据返回给DB2。您必须做的几乎相同,但不是查询Twitter,而是配置其他数据库。
http://angocadb2.blogspot.fr /2012/02/accediendo-tweeter-desde-db2-table.html


I have two database server one is mysql another is db2 both are running on different machine.I want to fetch records from tables from both the database by using a join.i have studied about linked server concept but the problem is i couldnt find any example for creating a linked server with db2(all i can find is SSMS i.e use Sql Server Mannagement Studio for creating linked server) but mine is case is of mysql and db2 and i need to create a linked server to one of them/vice versa.

Please suggest some help how can i achieve this.

Thanks in advance!

解决方案

In DB2, there is a feature called federation (part of Information Integration), that allows you to present external resources to DB2 (wrapper and nickname); you can query those external resources from DB2, and even you can do joins between different sources (Other DB2 databases, Informix | MSSQL server | Oracle | MySQL databases, flat files, etc.) In order to query external resources, this feature requieres a special licence. Instead, if you want to query other DB2 or informix databases, this feature does not requiere extra license because it is included as free (these are the IBM databases).

In order hand, there is an option called table functions. These functions return a table when they are called, and then, you can join the returned data with other table. These functions can be developed in SQL PL (IBM procedure language), C or Java.

With this second option, you can create a table function in Java, that queries the MySQL table, and then returns the data to DB2. I have written an example about how to query a 'topic' in Twitter, and return that data to DB2. You have to do almost the same, but instead of querying Twitter, you configure your other database. http://angocadb2.blogspot.fr/2012/02/accediendo-tweeter-desde-db2-table.html

这篇关于使用db2配置mysql链接服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆