Skip to main content
Version: 7.9

system.db.setDatasourceEnabled

This function is used in Python Scripting.

Description

Enables/disables a given database connection.

Client Permission Restrictions

Permission Type: Datasource Management

Client access to this scripting function is blocked to users that do not meet the role/zone requirements for the above permission type. This function is unaffected when run in the Gateway scope.

Syntax

system.db.setDatasourceEnabled(name, enabled)

Parameters

TypeParameterDescription
StringnameThe name of the database connection in Ignition.
BooleanenabledEnables/disables a given database connection.

Returns

Nothing

Scope

All

Code Examples

Example #1
# Example 1: Enable a connection

system.db.setDatasourceEnabled("MySQL", 1)
Example #2
# Example 2: Disable a connection

system.db.setDatasourceEnabled("MySQL", 0)