The IP.Board database object (usually the $this->DB object in the IP.Board code) is set up by default to connect to the database that has its info defined in your conf_global.php file. You can use the IP.Board framework to quickly create a secondary database connection that has access to all of the same functions. This comes in very handy if you ever need to connect to a database external to your IP.Board install to pull in info from it.
Here's the basic code for it:
/* Set up our alternate database object */ ips_DBRegistry::setDB( 'mysql', 'db2', array( 'sql_database' => '***', 'sql_user' => '***', 'sql_pass' => '***', 'sql_host' => '***', 'sql_charset' => '***', 'sql_tbl_prefix' => '***' ) ); $DB2 = $this->registry->DB( 'db2' );Just fill in that info related to the database on the top line, and $DB2 now is a database object that connects to this secondary database.
If your code is inside a class, you can also adapt this code to create a $this->DB2 object, it's best to do that in the class's constructor. That way, the database object exists throughout the class.