LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to cancel an ongoing database query that's taking a long time?

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?

0 Kudos
Message 1 of 5
(2,179 Views)

@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.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 5
(2,159 Views)

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.

0 Kudos
Message 3 of 5
(2,146 Views)

What DB server are you using? If you are using MySQL there is a TCP library that works which you can terminate.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 5
(2,143 Views)

@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

0 Kudos
Message 5 of 5
(2,109 Views)