10-07-2015 03:55 PM - edited 10-07-2015 03:56 PM
I'm running an SQL query using the Database Connectivity VI's. Nothing's modified on their block diagrams.
I noticed that when this query executes, it updates the DB just like you might expect, but when I try and obtain the result of the final SELECT, diving into the fetch_all VI, I see that the recordset which was created during the query execution VI is closed, so no data is returned. The cursor type on the sql query execution VI is normally just left as the default (forward-only), but I noticed that there was a new recordset creation when using a different cursor type, and thought this could be the root of my problem.
Solved! Go to Solution.
10-08-2015 02:03 PM
I ended up figuring it out! I posted this on the LabVIEW subreddit, and it turns out the database connectivity VIs aren't very good with batch queries. I switched over to using methods and properties of the OdbcConnection, OdbcCommand, and OdbcDatareader classes to achieve what I wanted. Here's the code if you're interested:
10-08-2015 02:41 PM
So where do you close the recordset in your solution?
Where do you close the connection reference?
You need to handle these references, to make sure that for once you don't have too many connections open to the database and that the memory is released.
10-08-2015 02:43 PM
That's handled elsewhere in the application. The open connection reference is held on to (not exactly as seen in the picture), as the application continously runs until it reachs some stop condition.