Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Scripting_function



Panel
titleDescription

Enables/disables a given database connection.


Panel
titleClient 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.


Panel
titleSyntax

system.db.setDatasourceEnabled(name, enabled)

  • Parameters

String name - The name of the database connection in Ignition.

Boolean enabled - Specifies whether the database connection will be set to enabled or disabled state.

  • Returns

Nothing

  • Scope

Gateway, Vision Client, Perspective Session



Panel
titleCode Examples


Code Block
languagepy
titleCode Snippet - Enabling a Database Connection
# Enable the database named "MySQL"
 
system.db.setDatasourceEnabled("MySQL", 1)
Panel


Code Block
languagepy
titleCode Snippet - Disabling a Database Connection
# Disable the database named "MySQL"
 
system.db.setDatasourceEnabled("MySQL", 0)



Panel
titleKeywords

system db setDatasourceEnabled, db.setDatasourceEnabled