[TYPO3-dev] External DB connection inside an extension ?

Ernesto Baschny [cron IT] ernst at cron-it.de
Thu Jul 10 20:04:11 CEST 2008


Dmitry Dulepov [typo3] wrote: on 10.07.2008 19:49:

>> Then, in my extension, I open a new connection to my external db via 
>> mysql_connect command. I'm able to get all necessaries datas with 
>> queries ... no problem .. until here.
>>
>> The problem come just after. After this mysql_query on external db, I 
>> don't know why but I lost the connection to Typo3 db :(.
> 
> This happens in PHP if you use the same user name and password to 
> different databases. PHP just selects another database and reuses the 
> same connections. Normally each database must have its own user.

True! And Stephane, Mauro: The reason why with AdoDB it works, is 
because NConnect calls mysql_connect with the $new_link=TRUE parameter, 
which defaults to "FALSE" (re-use existing link).

See:

http://www.php.net/mysql_connect

for more details on the mysql_connect parameter $new_link.

Cheers,
Ernesto




More information about the TYPO3-dev mailing list