How to Check Database Connection Programmatically in TestStand

Updated Jun 16, 2020

Reported In

Software

  • TestStand

Issue Details

I would like to have a way to check that the database is connected to TestStand just before I log the data to the database, so that the insert step will not fail. How can I do this? 

Solution

You can test the connection between TestStand and your Database using a Pass/Fail Test Step, which calls the LabVIEW code which is attached to this article. To do this please use the following steps: 
1.Download the LabVEW code and save it to your PC.
2.Enter the UDL file path into the UDL File control on LabVIEW, right click the UDL File control and go to Data Operations>> Make Current Value Default,
3. Save and close the LabVIEW code.
4. Enter TestStand and add a Pass/Fail Test step from the insertion Palette. 
5. Load the VI into the step, in the Module tab of the step settings as seen below: 
6. Configure the parameter value for OK, so the Value is Step.Result.PassFail. 
7. You can then Configure the Post Actions in the Properties tab so that you get different behaviour depending on whether the connection is successful or not. 

Additional Information

If you wish to check the database connection just before logging the data, please insert this step into the Setup section of the Callback within the LogToDatabase Sequence. This sequence can be located from the SequentialModel.seq sequence file.