LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DB Tools Execute Query - problem while using in parallel ?

Solved!
Go to solution

Hi,

 

for my project I have to write data with a lot of columns (>256) into different database tables. For that reason I used the "DB Tools Execute Query", since I cannot use a cluster (max 256 elements).

 

I have 10 parallel loops in my software, each of those aquiring data and writing it in my DB. So, each of these loops calls my "insert-in-DB.vi" every 10 seconds and creates this long SQL query string for my "DB Tools Execute Query".

 

But there seems to be a problem: Sometimes, I get an error saying "column count does not match columns in table". And I do not have an explanation for this.

 

Could this be because of the parallel execution and (with the "right" timing) perhaps the data of one query-string slips into one of the other query strings (making at least one of those strings longer or shorter in terms of column size)?

 

Or any other ideas?

 

db-tools-exe-problem.png

0 Kudos
Message 1 of 4
(1,375 Views)

Race problems is a very common LV issue, but if you're using your Insert-in-DB everywhere and it's not Reentrant it can only ever execute 1 Query at a time and that shouldn't be an problem.

However, there's a common limit of 8192 bytes in a Query, which could very well cause the issue of not sending all the columns.

If that's what's happening you'll need to to e.g. skip the last 20 columns and send them as an Update instead.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 4
(1,370 Views)

That seems plausible. Thank you for your information about the query length limit.

 

I will look into that and insert a "if query-size>8192 Byte" condition, to see if this gets triggered. Then I will let you know if this was the case.

0 Kudos
Message 3 of 4
(1,360 Views)
Solution
Accepted by topic author mw42

The problem has been found. A piece of code failed to generate the necessary number of columns (caused by an error, therefor returning "0" as a status, which in return was sent to DB modul as the only column).

 

But now I know that my string has a maximum length of under 6.000 Bytes and should not be a problem in the future. So thanks @Yamaeda

Message 4 of 4
(1,291 Views)