Jump to content
Sign in to follow this  
Bagata

Firedac Query.open problem 'Connection is busy with results for another command'

Recommended Posts

Hello,

I have one problem with Query.open on one of the forms in application.
This message is appearing only on this query, and more strange is that is appearing only with certain input parameters, with different data relates on different way.

Enabling MARS is not an option, with MARS enabled is working well, but is causing problems on other forms, so I need to put it in work without MARS enabled, 


I tried FDConnection.AbortJob, I even tried to close connection, and open again, but I am getting this message again and again. Any ideas how can be this fixed ?

image.png.d5d3f28eb3ea3c491f397f1a2ef41360.png

   

Share this post


Link to post
3 minutes ago, Anders Melander said:

Are you using asynchronous query execution (ResourceOptions.CmdExecMode <> amBlocking) anywhere?

nope 😕

Share this post


Link to post

Well, that sucks.

I think you can use management studio to determine if your connection has an active query. Maybe that can provide some clues.

Share this post


Link to post
53 minutes ago, Anders Melander said:

Well, that sucks.

I think you can use management studio to determine if your connection has an active query. Maybe that can provide some clues.

I tried to catch at the moment before query.open happens, but there is nothing active for my spid

Share this post


Link to post
On 12/17/2022 at 1:01 AM, Dmitry Arefiev said:

Set FetchOptions.Mode=fmAll

I would agree but he said that he:

On 12/16/2022 at 5:37 PM, Bagata said:

even tried to close connection, and open again

 

Doesn't closing the connection also close all open cursors associated with the connection?

Share this post


Link to post

Note that any query / Transact-SQL Code that tries to return two or more results sets will produce that error when MARS is off. Look for an IF or other structures in the SQL code that could end up running more than one SELECT statement for some code paths. Could be inside a stored procedure or in code you send to execute. Another place it can happens is not fully reading one result before going on to another. 

Share this post


Link to post
1 hour ago, Anders Melander said:

I would agree but he said that he:

 

Doesn't closing the connection also close all open cursors associated with the connection?

Yes, it is. But we are talking about "poesie", not about the "code" ...

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×