08-04-2020 06:07 AM
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?
Solved! Go to Solution.
08-04-2020 06:22 AM
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
08-04-2020 06:33 AM
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.
08-05-2020 02:42 AM
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