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

Stephane stephane.lists at gmail.com
Thu Jul 10 17:55:14 CEST 2008


Hi again

I just done a test with $dbConn->NConnect($server, $username, $password, 
$dbname); instead of connect or pconnect (with ADOdb) and it's seems to 
work well now.

Thanks a lot !!!

Stephane

Mauro Lorenzutti wrote:
> Hi Stephane,
>
>   
>> Hi Typo'Gurus
>>
>> I nedd your help. I have a question about external db connection inside 
>> typo3 extension.
>>
>> I'm writing an extension who needs to get data from another db (I know, 
>> accessing directly to external db is not the best way, but it's the more 
>> efficient approach (for speed) than I found after testing SOAP (SOAP is 
>> very very very slow) and Co).
>>
>> 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 :(.
>>
>> $GLOBALS['TYPO3_DB']->sql_num_rows return always return 0 (records exist 
>> of course), until I call back $GLOBALS['TYPO3_DB']->connectDB().
>> After this call I could again access to Typo3 db.
>>
>> Sample code / algo :
>>
>> $mylink = mysql_pconnect($server, $username, $password);
>>   
>>     
>
> I already noticed this problem and I solved it with a mysql_nconnect 
> insteas of mysql_pconnect. I hope this will solve your problem.
>
> P.S. If you are connecting an external DB in TYPO3, have you ever tried 
> the "DB Integration" (wfqbe) extension?
>
> Regards,
>
>   




More information about the TYPO3-dev mailing list