I’ve developed a service application in Delphi that handles GraphQL queries. The primary function of this application is to fetch data from a Microsoft SQL database and supply it to a Magento webshop.
The application works as expected for the most part. However, I occasionally encounter the following error:
[FireDAC][Phys][ODBC][Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hStmt
In an attempt to resolve this issue, I’ve implemented several changes based on solutions I found online:
Query1.Connection.FetchOptions.RowsetSize := -1;
// this did not help
Query1.ResourceOptions.CmdExecMode := amAsync;
// this did not help; it resulted in an access violation error message!
Query1.ResourceOptions.CmdExecMode := amNonBlocking;
// this did not help
Query1.Connection.Params.Values['ODBCAdvanced'] := 'MARS_Connection=YES';
or
Query1.Connection.Params.Values['ODBCAdvanced'] := 'MARS=YES';
// this did not help
Unfortunately, none of these modifications have been successful in preventing the error message. I even introduced a delay after retrieving the results using Sleep(3000), but this too proved ineffective.
I’m reaching out to this community in the hope that someone might have encountered a similar issue and can provide some guidance or suggestions on how to fix this problem. Any help would be greatly appreciated!
2
It sounds like you share a single connection for all requests, this might be a bad idea. Usually one does a connection pooling solution so you have at most one execution per connection at the same time
55 mins ago
MARS support has been a thing since SQL Server 2005. Is it possible that somewhere in your software stack you have a really old version of SQL Server, the SQL Server Native Client driver, or perhaps even FireDAC?
1 min ago