Fiz algo parecido, no banco de dados de autenticacao eu tenho uma coluna com o nome do banco que o usuario usa... ai depois sobrescrevi a classe ORM para ler da sessão:
class ORM extends Kohana_ORM {
protected function _initialize()
{
// Set the object name and plural name
$this->_object_name = strtolower(substr(get_class($this), 6));
$this->_object_plural = Inflector::plural($this->_object_name);
if ( ! $this->_errors_filename)
{
$this->_errors_filename = $this->_object_name;
}
if ( ! is_object($this->_db))
{
if($this->_db_group == 'default')
{
$this->_db = Database::instance('default', array
(
'type' => 'mysql',
'connection' => array(
'hostname' => Session::instance()->get("config")->host,
'database' => Session::instance()->get("config")->database,
'username' => Session::instance()->get("config")->user,
'password' => Session::instance()->get("config")->password,
'persistent' => FALSE,
),
'table_prefix' => '',
'charset' => 'utf8',
'caching' => FALSE,
'profiling' => TRUE,
));
}else{
$this->_db = Database::instance($this->_db_group);
}
}
if (empty($this->_table_name))
{
// Table name is the same as the object name
$this->_table_name = $this->_object_name;
if ($this->_table_names_plural === TRUE)
{
// Make the table name plural
$this->_table_name = Inflector::plural($this->_table_name);
}
}
foreach ($this->_belongs_to as $alias => $details)
{
$defaults['model'] = $alias;
$defaults['foreign_key'] = $alias.$this->_foreign_key_suffix;
$this->_belongs_to[$alias] = array_merge($defaults, $details);
}
foreach ($this->_has_one as $alias => $details)
{
$defaults['model'] = $alias;
$defaults['foreign_key'] = $this->_object_name.$this->_foreign_key_suffix;
$this->_has_one[$alias] = array_merge($defaults, $details);
}
foreach ($this->_has_many as $alias => $details)
{
$defaults['model'] = Inflector::singular($alias);
$defaults['foreign_key'] = $this->_object_name.$this->_foreign_key_suffix;
$defaults['through'] = NULL;
$defaults['far_key'] = Inflector::singular($alias).$this->_foreign_key_suffix;
$this->_has_many[$alias] = array_merge($defaults, $details);
}
// Load column information
$this->reload_columns();
// Clear initial model state
$this->clear();
}
}