LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lost ODBC Connection from development environment

Using LV 7.1 and an Active-X based ODBC Connection scheme to a MySQL database which has worked flawlessly up until now.  I've just written an application which accesses the database to generate a 'recipe' for our operators to follow.  This is poked into a multicolumn listbox, and works perfectly from the compiled version.  However, when I'm running the very same program in the development envirnment, I will get an error which indicates I have lost the connection to the database.  Never happened from the built versions, and yes, I'm running exactly the same code.  This is irritating, as when I'm trying to debug the SQL pieces, the code crashes.  Happily, the compiled versions are working, but it makes me nervous when programs crash like this.

I am doing a listbox refresh every 60s or so, which involves accessing the database, reading a large chunk and displaying it. Im' also doing an ODBC conncetion check every 2s, and possibly some other database access depending on the operator input.  MySQL is set up so that I can have 100 threads open at once, and I never approach that.  I always open, do command, then close and destroy connections. 

All I can think of is that there is a difference in the timing and the database access between the developement environment and the compiled versions.

Any thoughts anyone? 
0 Kudos
Message 1 of 4
(2,480 Views)
If you take the development code that crashes, build it into an executable, then run it, does it work?  Did this program run fine in the development environment previously?  Maybe try to scale your program down to some basic stuff, then start building it back up until it breaks to determine what is causing this.  All of this information will help us determine what's going on with the error.
Brian B
Account Manager
National Instruments
0 Kudos
Message 2 of 4
(2,462 Views)
Hi,

Yes, that is exactly what I have done.  Built the executable which runs without problems.

I've also tried to strip the program down by simply running the piece which polls the database continually. This seemed to run fine until I ran another program which also accessed the same database. So, to summarize:

1.  The development environment program with single loop running accessing the database every 2s or so runs fine.
2.  The dev. env. app. running multiple loops possibly accessing the db concurrently crashes
3.  The same program as 2 but built into an application runs fine.

MSB
0 Kudos
Message 3 of 4
(2,454 Views)
Hey MSB,
    It seems there is some type of race condition happening when the VI is in the development environment as opposed to a built exe.  Rather than performing numerous database connections at once, you could open a single connection and use a functional global to read/write data into the database.  This should help you avoid having to create and destroy connections all the time.
Brian B
Account Manager
National Instruments
0 Kudos
Message 4 of 4
(2,441 Views)