Using system.db.runScalarPrepQuery to pull data from a different Database source

I am using multiple database connections and need to understand how to direct my query to those connections to retrieve data. It always looks at the default in the below script. The location of the InventoryInformation db connection is ‘Athens/InventoryInformation’ but it goes to the default connection instead and putting ‘Athens’ in there makes it angry.

sn = event.source.parent.getComponent(‘SerialNumber’).text
event.source.parent.getComponent(‘Table’).data = system.db.runScalarPrepQuery(“SELECT LotUUID FROM InventoryInformation WHERE SerialNumberOut = ‘%s’” % (sn))

You can define the database as an additional parameter.

There isn’t an example in the manual for runScalarPrepQuery, but there is one for runPrepUpdate. Just follow the style.

# This example would gather some user entered text and insert it into the database.
# The difference between this example and the previous example is that this example is explicitly declaring which database connection to run the query againt.
# Sometimes you need to run a query against a database connection that is not the default connection.
userText = event.source.parent.getComponent("TextArea").text
userName =
databaseConnection = "AlternateDatabase"
system.db.runPrepUpdate("INSERT INTO Comments (Name, UserComment) VALUES (?,?)", [userName, userText], databaseConnection)