10-23-2018 08:30 AM
I'm working on a program that allows users to run a few queries on one of our research data databases. Some times the query can take a long time to finish and user may realize that they wish they had narrowed the search criteria during this time and would like to cancel the active query and start over.
However, I can't figure out how to actually terminate a query that's in progress. I found this webpage Terminate Stop or Kill Long Running SQL Server Query, but it doesn't make sense to me and seems really complex to perform a simple task that I find hard to believe there isn't a simple/easy way. Is there any easy way I'm just not seeing or maybe an example VI someone could share?
10-23-2018 09:48 AM - edited 10-23-2018 09:50 AM
@DoctorAutomatic wrote:
I'm working on a program that allows users to run a few queries on one of our research data databases. Some times the query can take a long time to finish and user may realize that they wish they had narrowed the search criteria during this time and would like to cancel the active query and start over.
However, I can't figure out how to actually terminate a query that's in progress. I found this webpage Terminate Stop or Kill Long Running SQL Server Query, but it doesn't make sense to me and seems really complex to perform a simple task that I find hard to believe there isn't a simple/easy way. Is there any easy way I'm just not seeing or maybe an example VI someone could share?
We have not found a way to terminate a query that is being done using the DB toolkit. In fact, we have recently abandoned the toolkit in favor of direct TCP communication with the DB. We are using MySQL which has a TCP interface. I am not sure if MSSQL does. We also found that the DB toolkit was single threaded so it blocked us from actually performing queries in parallel, even if we used a different connection.
If you have complete access to the server you can terminate the query on that end but I don't think that will help your particular situation. This method could be used if the application is completely hung though.
10-23-2018 11:05 AM
Unfortunately I don't have enough server access to terminate it from that end.
So basically any vi that initiates a long query is frozen for the duration of the query? Can't even cancel it on the client/labview execution side?
For some reason this really surprises me as long running queries are a common enough thing along with not having access to kill the query from the server. Ctrl-Alt-Del & End Task are the only way to escape when a query is unexpectedly long and locking up the vi? ugh, doing this development has been a pain due to the amount of times I've had to force quit LabVIEW.
Thanks for all the responses.
10-23-2018 11:09 AM
What DB server are you using? If you are using MySQL there is a TCP library that works which you can terminate.
10-25-2018 08:32 PM
@Mark_Yedinak wrote:
What DB server are you using? If you are using MySQL there is a TCP library that works which you can terminate.
Oracle