Scripting Functions (system.db...)

I am a new user and I don’t have Ignition running on this PC so I cannot test (sorry!).

I am executing a Gateway Script with 1 database connection. Everything works fine.

We are adding a 2nd database and I want to write to the 2nd DB in the same script.

The syntax of system.db.runUpdateQuery looks like this:
system.db.runUpdateQuery(query, database, tx, getKey, skipAudit)
http://inductiveautomation.com/support/usermanuals/ignition/index.html?system_db_runupdatequery.htm
Currently I do not reference a DB so it uses the default database connection.

When I reference a specific database, is this the Name defined in Ignition, the SQL Server database name, or something else?
Also, where is the project’s “default database connection” defined and how is it changed?

Look in the Project General Properties for the default database connection (when you open the project in Ignition Designer or from the web interface Configure -> Configuration -> Projects -> (your project) -> Edit).

In scripting, use the name you specified in Ignition’s interface (instead of the SQL Database name).