鍍金池/ 問答/PHP  Linux  數(shù)據(jù)庫  網(wǎng)絡(luò)安全/ could not translate host name "user

could not translate host name "user=" to address: Unknown host?

CI框架+postgerSQL+nginx
現(xiàn)在又2個數(shù)據(jù)庫:中心庫center,公司庫:n001
登錄時使用中心庫驗證,可以正常登錄。
在控制器A構(gòu)造方法中,加載公司庫:n001.
訪問index方法,可以查詢n001數(shù)據(jù)庫中的數(shù)據(jù)。
但是在B方法中,使用同樣的查詢語句,則報錯:

ERROR - 2017-11-08 15:12:12 --> Severity: Warning --> pg_pconnect(): Unable to connect to PostgreSQL server: could not translate host name "user=" to address: Unknown host D:\www\system\database\drivers\postgre\postgre_driver.php 153
ERROR - 2017-11-08 15:12:12 --> Unable to connect to the database
ERROR - 2017-11-08 15:12:12 --> userdb:{"dbdriver":"postgre","schema":"public","dsn":"host= user= dbname=","username":null,"password":null,"hostname":null,"database":null,"subdriver":null,"dbprefix":"","char_set":"utf8","dbcollat":"utf8_general_ci","encrypt":false,"swap_pre":"","port":"","pconnect":true,"conn_id":false,"result_id":false,"db_debug":false,"benchmark":0,"query_count":0,"bind_marker":"?","save_queries":true,"queries":[],"query_times":[],"data_cache":[],"trans_enabled":true,"trans_strict":true,"cache_on":false,"cachedir":"","cache_autodel":false,"CACHE":null,"autoinit":true,"stricton":false}
ERROR - 2017-11-08 15:12:12 --> Severity: Warning --> pg_pconnect(): Unable to connect to PostgreSQL server: could not translate host name "user=" to address: Unknown host D:\www\system\database\drivers\postgre\postgre_driver.php 153
ERROR - 2017-11-08 15:12:12 --> Unable to connect to the database
ERROR - 2017-11-08 15:12:12 --> Severity: Warning --> pg_last_error() expects parameter 1 to be resource, boolean given D:\www\system\database\drivers\postgre\postgre_driver.php 480
ERROR - 2017-11-08 15:12:12 --> Query error:  - Invalid query: select * from sys_column where grid_id='477F6FAD-B3A8-653E-B41C-3999DEB0F890' order by sort_code asc

最后一條提示錯誤的SQL語句是沒問題的,可以出結(jié)果。

請問這樣改如何解決?

回答
編輯回答
尐懶貓

提示你沒有配置數(shù)據(jù)庫信息,提示沒有連接到數(shù)據(jù)庫

2018年6月10日 05:12