[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Typo3-dev] Connecting to a different db kills typo3 db connection?

  • From: martin.kutschker at no5pam.blackbox.net (Martin Kutschker)
  • Date: Mon, 1 Aug 2005 09:14:05 +0200

"Dmitry Dulepov" <typo3 at fm-world.ru> schrieb im Newsbeitrag 
news:mailman.1.1122840113.428.typo3-dev at lists.netfielders.de...
> As you see I am creating a new link (last parameter to mysql_connect),
> so it should not interfer with any other database connection. However,
> any extension, that uses TYPO3_DB after my extension, looses database
> connection when the code above is executed. If I replace the last line
> (mysql_close) with mysql_select_db('typo3db_name', $rc) than everything
> works fine!
> The code above is located in a separated function, no global variables
> are used.
> Is this a bug? I am using version 3.7.0 with PHP 4.3.11 and MySQL 3.23.
> Typo3 uses mysql_pconnect.

I think that many old stlye extensions use a) mysql calls directly (instead 
of the DB layer) and b) don't use the resurce link in their mysql calls.

So they work on the last openened connection, which may be yours. Whether 
you close the connection or not is irrelevant. The calls will use the wrong 
db, unless as you do you switch to the TYPO3 db with a mysql_select_db. 
Which will make problems if the dbs are not on the same db server.

Solution: write to the extension authors to fix their code.