[Typo3-dev] connecting to an additional database
Ries van Twisk
typo3 at rvt.dds.nl
Tue Apr 26 18:24:12 CEST 2005
Rainer,
I use the database abstraction layer for this.
You can connect to a other DB at ease.
The _DEFAULT is the default database connection.
My mysql_hostip is a connection to a other database
This is what I have in localconf.php:
$TYPO3_CONF_VARS['EXTCONF']['dbal']['handlerCfg'] = array (
'_DEFAULT' => array (
'type' => 'native',
'config' => array(
'username' => '', // Set by default (overridden)
'password' => '', // Set by default (overridden)
'host' => '', // Set by default (overridden)
'database' => '', // Set by default (overridden)
)
),
'mysql_hostip' => array (
'type' => 'native',
'config' => array(
'username' => 'username',
'password' => 'password',
'host' => 'localhost',
'database' => 'databasename',
'driver' => 'mysql'
),
)
);
// This will tell TYPO# what tables can be found in in the DB.
// all the tables below are going to be found in the db 'mysql_hostip'
// Ofcourse i's possible to connect to postgresql, ms-sql etc...
// Al what's supported with adodb....
$TYPO3_CONF_VARS['EXTCONF']['dbal']['table2handlerKeys'] = array (
'ip4_0' => 'mysql_hostip',
'ip4_1' => 'mysql_hostip',
'ip4_2' => 'mysql_hostip',
'ip4_3' => 'mysql_hostip',...........
);
> Hi all,
>
> I'm just wondering if there are any DBAL-compliant methods for
> initializing a database connection to an additional (non-TYPO3) database?
>
> Is it o.k. for the moment to use the MySQL wrapper functions in
> class.t3lib_db.php to connect/select an additional MySQL database or
> is there a better, "future-compliant" way to do?
>
> Thanks,
> Rainer
> _______________________________________________
> Typo3-dev mailing list
> Typo3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
--
R. van Twisk
http://www.metamorf.net
Our Typo3 enabled website: http://www.livetravelguides.com
Instand help for Typo3? irc:/irc.freenode.net/typo3
Looking for documentation? http://typo3.org/documentation/
More information about the TYPO3-dev
mailing list