如何连接不同服务器上的两个不同数据库 [英] how to connect two different database which are on different server

查看:292
本文介绍了如何连接不同服务器上的两个不同数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我想知道如何连接位于php中两个不同数据库服务器上的两个数据库

感谢

hi everyone

i want to know about how can i connect two database that are located on two different database server in php

thanks

推荐答案

A)您想从同一php代码访问两个数据库吗?
没什么特别的.无论您在php中选择哪种mysql接口(旧的,MySQLi,PDO_MySQL),都将获得上下文资源或对象,您可以(必须)在与该数据库连接有关的所有以后的活动中使用该对象.



B)您想让涉及两个不同数据库的sql查询吗?
好吧,这不直接涉及php,而是数据库引擎.在这里看看:
http://dev.mysql.com/doc/refman/5.1/en/federated-storage-engine.html [ ^ ], http://winashwin.wordpress.com /2012/08/22/mysql-federated-table/ [
A) You want to access two databases from the same php code?
There is nothing special about. Whatever mysql interface you choose in php (old one, MySQLi, PDO_MySQL), you get a context resource or an object you can (have to) use in all your future activities related to that database connection.

or

B) You want to have sql query involving two different databases?
Well, that does not involve php directly, but the database engine. Look around here:
http://dev.mysql.com/doc/refman/5.1/en/federated-storage-engine.html[^], http://winashwin.wordpress.com/2012/08/22/mysql-federated-table/[^]


这篇关于如何连接不同服务器上的两个不同数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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