我遇到的似乎是Advantage Database PHP扩展中的错误(我知道,我知道......)。我已将它报告为一个错误,但仍然没有收到任何回复,所以我想我会帮你们运行它。

工作代码:

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 );
}

这只循环100次,连接到db,执行查询并断开连接。

非工作代码:

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 );
}

注意第二次查询执行?此循环在第51个周期(数据库服务器将每个应用程序限制为50个同时连接)失败并显示错误

  

错误6303:最大优势   超出了数据库服务器连接。

我尝试过其他一些事情,包括这个没有成功:

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 );
}

然而, DOES 解决了这个问题,并且BOTH查询仍能成功准确地执行!!

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 );   
}

这对我来说似乎很奇怪......有什么想法吗?

编辑:我使用的是PHP 5.2.5和ADS 8.1

有帮助吗?

解决方案

知识库中有关于6303错误的此项以及如何增加客户端可能的连接数, http://devzone.advantagedatabase.com/dz/content.aspx?Key=17&RefNo=981124-0621 。 R&amp; D目前正在研究这个问题,并努力在下一个服务版本中解决它。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top