LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open Database Connections

I've ported some code over from LabVIEW7.1 to 8.6 which updates a table in a MYSQL database.  The problem is that the new code leaves a database connection open after execution (while the 7.1 code does not).  I would like to know if anyone has seen this behavior and if they know a fix, and if not, how would they go about debugging this problem.

 

I am using the MYSQL ODBC connector, version 5.1.

 

Some observations:

 

1. This vi is part of a TestStand 4.2 sequence, and the sequence writes results at the end of testing using TestStand's built in functionality to do this.  What's notable is that unlike the vi, the database connection used to write the results is closed properly.

2. I've used the "trace" tool in windows ODBC panel but the information is overwhelming large, cryptic and doesn't  contain recognizable strings.  To reduce the size of the file I tried to start and stop it so that it was tracing only during the execution of the vi.

This didn't work - the tool did not record any information.

3. Stepping through the vi...

     a. The database connection problem does not appear.

     b. The error cluster is always empty indicating no errors have ocurred.

4. No errors happen during normal execution.

5. I've added delays of 5 seconds between some of the database vi calls and still the database connection is left open.

 

The vi that's causing the problem is attached.

 

Thanks in advance.

 

0 Kudos
Message 1 of 12
(3,291 Views)
You have a clean error in the middle, but i dont see how that should cause this. I reacted a little to the Select query using double quotes instead of single ones, NID="***"; instead of NID='***';
Might that be a reason?

Unpacking that sequence made it easier to read, i might add. 😉

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 12
(3,273 Views)
I'm with Yamaeda on unpacking the sequence here.  You are doing a good job of using the error terminals, having the stacked sequence structure just makes it much more confusing to read.  You NEVER need a stacked sequence structure, and not even a flat sequence structure when you have good error handling like you do.
0 Kudos
Message 3 of 12
(3,231 Views)

I've replace the double quotes with single quotes and unfortunately the vi to close the database connection isn't working.

 

Does anyone have any other ideas?  Is there a low level or debug version of the database connectivity vi's that I can use?  I need some debug capability here.

 

 

0 Kudos
Message 4 of 12
(3,205 Views)
You should be able to open the Database Connectivity VI's and place breakpoints and Highlight Execution in them (i've done), which really help to solve the issue. I just recently discovered that the Insert Data didn't handle column names with spaces since there's no true standard to such naming. SQL Server uses [column name] e.g. so to pass such issue you'll have to build your query yourself and use 'Execute Query' or simplify names.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 12
(3,199 Views)

My advice is to get rid of the sequence structure and either string everything along left to right, or preferably use a state machine.  Turn on highlighting and look for an error condition on the error wires.  Maybe put a probe on the DB reference wire and compare what you see to the value after the DB open function.  An improper reference or an error could cause the DB to not close.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 12
(3,191 Views)
I've already tried these suggestions.  See observation #3 above.  The problem doesn't happen when I step through the code.
0 Kudos
Message 7 of 12
(3,182 Views)

No problem when stepping through the code and having a problem when running at full speed suggests a timing problem.  Try putting delays at various places.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 12
(3,180 Views)
Regarding the delays, see observation #5 above.  Might want to check those observations again. Smiley Happy
0 Kudos
Message 9 of 12
(3,166 Views)
Am I missing something obvious?  Waiting for me to see it?
0 Kudos
Message 10 of 12
(3,165 Views)