External database connection via TYPO3 within a userfunction -
i using typo3 6.2.x , have second extern database , need update value table of database.
so have implemented simple userfunction following example (pseudocode):
public function updatevalue() { $updatedata = array( 'field1' => '1', 'field2' => '2' ); $globals['typo3_db']->exec_updatequery( 'example', 'value = 1234', $updatedata ); }
that's not problem far, table "example" table of extern database. reason have activated dbal , adodb via extension manager. after have created file typo3conf/additionalconfiguration.php contains following configuration:
<?php $typo3_conf_vars['extconf']['dbal']['handlercfg'] = array ( '_default' => array ( 'type' => 'native', 'config' => array( 'username' => '', 'password' => '', 'host' => '', 'database' => '', ) ), 'extdatabase' => array ( 'type' => 'native', 'config' => array( 'username' => 'username', 'password' => 'password', 'host' => 'host', 'database' => 'extern_database', ) ), ); $globals['typo3_conf_vars']['extconf']['dbal']['table2handlerkeys'] = array( 'example' => 'extdatabase', ); ?>
but not working , got following exception:
error: no handler key "extdatabase" :(
so extension configuration of dbal not set correctly. documentation of dbal seems out of date because there no reference additonalconfiguration.php localconf.php. dont know how can solve problem, hope can me.
damn :/
$typo3_conf_vars['extconf']['dbal']['handlercfg']
have be
$globals['extconf']['dbal']['handlercfg']
and working correctly.
Comments
Post a Comment