Is this a bug with Advantage Database?

三世轮回 提交于 2019-12-13 17:44:35

问题


I am running into what seems to me to be a bug in the Advantage Database PHP Extension (I know, I know...). I've reported it as a bug, but still haven't heard anything back, so I thought I'd run it by you guys.

Working Code:

for ($i = 0; $i < 100; $i++)
{
    $connection = ads_connect( 'DataDirectory=\\some\path\;ServerTypes=2;RightsChecking=Off;TrimTrailingSpaces=true;CommType=TCP_IP;', '', '' );

    $results = ads_do( $connection , 'SELECT TOP 1 * FROM projects');

    ads_close( $connection );
}

This just loops through 100 times, connects to the db, executes a query, and disconnects.

NON-Working Code:

for ($i = 0; $i < 100; $i++)
{
    $connection = ads_connect( 'DataDirectory=\\some\path\;ServerTypes=2;RightsChecking=Off;TrimTrailingSpaces=true;CommType=TCP_IP;', '', '' );

    $results = ads_do( $connection , 'SELECT TOP 1 * FROM projects');
    $results = ads_do( $connection , 'SELECT TOP 1 * FROM projects');

    ads_close( $connection );
}

Notice the second query execution? This loop fails on the 51st cycle (the db server limits each application to 50 simultaneous connections) with the error

Error 6303: Maximum Advantage Database Server connections exceeded.

I've tried several other things including this with no success:

for ($i = 0; $i < 100; $i++)
{
    $connection = ads_connect( 'DataDirectory=\\some\path\;ServerTypes=2;RightsChecking=Off;TrimTrailingSpaces=true;CommType=TCP_IP;', '', '' );

    $results = ads_do( $connection , 'SELECT TOP 1 * FROM projects');
    ads_free_result( $results );

    $results = ads_do( $connection , 'SELECT TOP 1 * FROM projects');
    ads_free_result( $results );

    ads_close( $connection );
}

This, however, DOES fix the problem, and BOTH queries still execute successfully and accurately!!

for ($i = 0; $i < 100; $i++)
{
    $connection = ads_connect( 'DataDirectory=\\some\path\;ServerTypes=2;RightsChecking=Off;TrimTrailingSpaces=true;CommType=TCP_IP;', '', '' );

    $results = ads_do( $connection , 'SELECT TOP 1 * FROM projects');
    ads_close( $connection );

    $results = ads_do( $connection , 'SELECT TOP 1 * FROM projects');
    ads_close( $connection );   
}

This all seems very odd to me... any ideas?

EDIT: I am on PHP 5.2.5 and ADS 8.1


回答1:


The knowledge base has this item on the 6303 error and how to increase the number of connections possible from a client, http://devzone.advantagedatabase.com/dz/content.aspx?Key=17&RefNo=981124-0621. R&D is currently looking into this problem and working to have it resolved in the next service release.



来源:https://stackoverflow.com/questions/822232/is-this-a-bug-with-advantage-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!