用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3129|回复: 4
收起左侧

[HELP] 数据库连接

[复制链接]
发表于 2012-8-23 18:36:22 | 显示全部楼层 |阅读模式
A
$db['default']['hostname'] = "172.16.1.52";
$db['default']['username'] = "zhaojian";
$db['default']['password'] = "888888";
$db['default']['database'] = "pom";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";


B
$db['pom']['hostname'] = "172.16.0.88";
$db['pom']['username'] = "pom";
$db['pom']['password'] = "pom";
$db['pom']['database'] = "pom";
$db['pom']['dbdriver'] = "mysql";
$db['pom']['dbprefix'] = "";
$db['pom']['pconnect'] = TRUE;
$db['pom']['db_debug'] = FALSE;
$db['pom']['cache_on'] = FALSE;
$db['pom']['cachedir'] = "";
$db['pom']['char_set'] = "utf8";
$db['pom']['dbcollat'] = "utf8_general_ci";


B 能 用 A报错
错误信息:                An Error Was Encountered                You have specified an invalid database connection group.



发表于 2012-8-24 00:02:03 | 显示全部楼层
$db['pom']['hostname'] = "http://172.16.0.88";
 楼主| 发表于 2012-8-24 10:54:31 | 显示全部楼层
跟屁虫 发表于 2012-8-24 00:02
$db['pom']['hostname'] = "http://172.16.0.88";

A 能用
发表于 2012-8-24 15:08:23 | 显示全部楼层
你要连接数据库的时候$this->load->database('pom', TRUE); 才可能上面那个是 你默认的是用的第一个链接 这个要制定B的链接
发表于 2013-1-29 17:53:44 | 显示全部楼层
守候眼泪不哭 发表于 2012-8-24 15:08
你要连接数据库的时候$this->load->database('pom', TRUE); 才可能上面那个是 你默认的是用的第一个链接 这 ...

我也遇到楼上的问题,提示You have specified an invalid database connection group.???我是填写了两个ip地址的,即是 连接 两台机的 数据库,望高人指教呀!先谢谢了。

本版积分规则