08-31-2023 04:58 PM
I'm following along with the KB article: Logging TestStand Results to a MySQL Database Tutorial and Log Test Results to Databases with TestStand. I am attempting to generate a new MySQL schema for the logging results to a MySQL database. I've managed to get the SQL file generated, but the generated sql file seems to have some errors in it.
First, the PROP_ANALOGWAVEFORM table is generated twice.
Second, the text following the "CONSTRAINT" calls is causing an error when attempting to create the table. See here when attempting to create the UUT_RESULT table:
I found some KB articles and this forum post talking about looking in the %TestStand%/Components/Models/TestStandModels/Database directory for the SQL files. It seems those files don't exist for 2022.
Is there something I'm missing? What is the correct procedure for generating a new MySQL database with TestStand 2022?
Environment Information
Solved! Go to Solution.
09-01-2023 06:58 AM
I have also found that one of the PROP_ANALOGWAVEFORM tables is generated without a length to the VARCHAR.
09-01-2023 07:46 AM
TL;DR: Files are in C:\Program Files\National Instruments\TestStand 2022\Components\Models\TestStandModels\Database and not in the path specified by the KB articles.
After digging through the MySQL documentation, some Stack Overflow forums (here and here), and poking at the NI Database Viewer, I found the issue.
I asked the Schema Validation tool to validate the schema for the MySQL Inserts.
Now, when I choose "Generate SQL" to "Add Missing Items". It opens up the Database Viewer. The SQL that's generated is not in a valid MySQL format.
This seems to be in MS Access dialect. From the forums, MySQL doesn't support inline named constraints for PRIMARY KEYs. Comments are also started with the wrong character. "//" instead of "#".
Now if we go to File > Open TestStand SQL Files, I find what I'm after.
Clicking on one of the files, activates the "Explore" button, which opens a file browser. The browser opens in "C:\Program Files\National Instruments\TestStand 2022\Components\Models\TestStandModels\Database".
Using the "recommended" path from the KB article doesn't resolve: