I use multiple DB connections in my Codeigniter application. When I load dbforge
it loads it for the current db connection. How can I set dbforge so it work with the second DB connection?

- 2,783
- 6
- 32
- 53
2 Answers
In EE1 it used to be:
mysql_select_db(<database name>);
or
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
...
mysql_close($conn);
I believe looking at example code elsewhere you can still use this approach.
For EE2 try:
$this->EE->load->dbforge();
$db = $this->EE->load->database(‘default’, TRUE);
Where the first parameter is looking for the database config settings group.
More info here: http://ellislab.com/codeigniter/user-guide/database/connecting.html
Examples of the old EE1 approach still working in EE2 here: http://expressionengine.com/forums/viewthread/213519/#992669

- 10,956
- 1
- 28
- 44

- 1,090
- 1
- 9
- 16
From our investigation, it appears that the issue is not directly related to our product' functionality. We recommend checking the documentation provided at https://codeigniter.com/userguide3/database/connecting.html
If the problem persists and is indeed related to our software, kindly complete the form. Please provide us with a detailed description of the issue and the actions you have taken so far. Additionally, attaching relevant screenshots will assist us in better understanding the problem.
Please ensure that you are using the latest version of dbForge Studio for MySQL.

- 119,203
- 23
- 166
- 186