LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conflict where multiiple separate built applications access the same Database in LabVIEW?

Hello, 

 

I have at least two built applications that access the same database. concurrently.

 

I suspect that since these are two built applications that run independently, there is a likelihood that some times each of these applications may just happen to open identical connection references. and depending on the application that completes a  query/fetch action first, the connection may be closed prematurely by one application causing the other which still requires it to go in error. Or  perhaps  one attempts to open a new connection reference which happens to be identical to an existing connection reference in the second application, and then goes in error.

 

Can someone please verify if this is possible and if there is a workaround. If the NI applications Engineers can weigh in, that would be great too.

 

 

 

0 Kudos
Message 1 of 2
(1,970 Views)

It depends on the database, and the driver.

 

The database should support this (Access for instance didn't, although by now it might).

 

Queries should be wrapped in transactions. So the driver you're using should have "begin transaction", "fail transaction", "close transaction" VIs. This will tread sets of queries as one transaction, and a supporting database will handle concurrent access for you.

 

EDIT: What you probably have now is a race condition. If two applications read a value, increase it, then write it, you'll only get 1 increment.

Message 2 of 2
(1,914 Views)