tp3 2中配置鏈結多個資料庫

2021-07-30 19:00:40 字數 1342 閱讀 9868

config.php

<?php

return array

(//『

配置項『=>『

配置值『

//快取

//『data_cache_type『 => 『memcache『,

//『memcache_host『   => 『tcp:  

//『data_cache_time『 => 『3600『,

『default_controller『    

=>  

『index『

, //

預設控制器名稱

『default_action『        

=>  

『index『

, //

預設操作名稱

//資料庫配置

beruiuser

『db_config1『

=>

array

(『db_type『  

=>

『mysql『

,『db_user『  

=>

『root『

,『db_pwd『  

=>

『aisijkl81『

,『db_host『  

=>

『192.168.0.111『

,『db_port『  

=>

『3306『

,『db_name『  

=>

『2222『,)

,//裡面存在跨庫操作

//資料庫配置

br_esfmanager

『db_config2『

=>

array

(『db_type『  

=>

『mysql『

,『db_user『  

=>

『root『

,『db_pwd『  

=>

『aisijkl8*1『

,『db_host『  

=>

『1111111『

,『db_port『  

=>

『3306『

,『db_name『  

=>

『444『,)

,//裡面存在跨庫操作

『domain『

=>

『demo『,//

這裡上線後應該為

api

**裡使用

$data=m()->db(2,"db_config2")->table("mn_r_house_web")->where($where)->find();

TP3 2資料庫轉換

除了在預先定義資料庫連線和例項化的時候指定資料庫連線外,我們還可以在模型操作過程中動態的切換資料庫,支援切換到相同和不同的資料庫型別。用法很簡單,只需要呼叫model類的db方法,用法 model db 資料庫編號 資料庫配置 資料庫編號用數字格式,對於已經呼叫過的資料庫連線,是不需要再傳入資料庫連...

rails鏈結多個資料庫

首先在database.yml中加入以下 其中cg clone是外部等待使用的資料庫。cg clone adapter mysql database cg clone username root password host localhost 假如在cg clone中有一張表叫contracts,那...

TA 3框架配置多個資料庫鏈結

1.配置jdbc.properties檔案,新增新的資料庫連線的引數 2.配置spring datasource.xml檔案,根據之前新增的資料庫引數新增新的datasource bean 3.配置spring datasource.xml檔案,根據新配置的datasource bean配置新的sq...