NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I select a database schema to use for a sequence file?

Solved!
Go to solution

I have multiple database schemas on my TestStand system and when I select a sequence file I need to set the schema so the results get entered into the database correctly.
I use a SequenceFileCallback for DatabaseOptions in my sequence file and in this I set Parameters.DatabaseOptions.DatabaseSchema.Name='xyz' where xyz is the database schema name that needs to be used. This does not work and it reports an error that it can not be loaded or the file may be corrupted. Does this feature work or do I just have an error in what I am setting this equal to?

0 Kudos
Message 1 of 6
(4,514 Views)

Hi plf,

 

It seems to me you are going about this the right way. The DatabaseOptions callback is called immediately before the process model fetches the schema statements based on the schema name. I was able to change the schema on the fly in the same way you are attempting (using the default sequential model and TestStand  4.1).

 

  • Ensure you are using a schema that is defined in the Database Options Dialog (Configure»Database Options»Schemas Tab»Schemas Listbox).
  • Ensure you are using the exact name of the desired schema (copy it from the Name textbox in the above Schemas Tab).
  • Ensure that choosing this schema manually works when you run this sequence file (to be sure it is not corrupted).
  • Check that you are using double quotation marks around the schema name, not single marks as in your post.



Evan Prothro
RF Systems Engineer | NI

0 Kudos
Message 2 of 6
(4,499 Views)
Solution
Accepted by topic author plf
Evan... It turns out your last bullet point: "Check that you are using double quotation marks around the schema name, not single marks as in your post.", resolved the issue. Funny it did not report an error with single marks. Thanks for the quick response! plf
0 Kudos
Message 3 of 6
(4,486 Views)
No problem, glad you are up and running.



Evan Prothro
RF Systems Engineer | NI

0 Kudos
Message 4 of 6
(4,482 Views)

I am trying to do the same thing, although I am using a mysql database and I am not using a DSN:

 

I get this error when running my sequence:

An error occurred calling 'NewUUT' in 'ITSDBLog' of 'zNI TestStand Database Logging'
An error occurred initializing a connection to a data link.
Connection String:
Unexpected token: ODBC

 

Here is the statement:

Parameters.DatabaseOptions.ConnectionString="Driver={MySQL ODBC 3.51 Driver}; Server=localhost; PORT=3306; DATABASE=DB; Option=3; Socket=; Stmt=; Uid=USER; Pwd=PASSWORD;"

 

This works PREFECTLY when entered directly in the db connection string dialog.  Is it trying to further parse my statement?  Do I need to escape the "s?  I will try that.

0 Kudos
Message 5 of 6
(4,259 Views)

Dude.  You guys crack me up.  TS is parsing the connection string!  You need to add another (escaped) set of double quote.

 

This works:

Parameters.DatabaseOptions.ConnectionString="\"Driver={MySQL ODBC 3.51 Driver}; Server=localhost; PORT=3306; DATABASE=DB;

Option=3; Socket=; Stmt=; Uid=USER; Pwd=PASSWORD;\""

 

 

Message 6 of 6
(4,257 Views)