This function is used in Python Scripting.


Adds a new database connection in Ignition.

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.


system.db.addDatasource(jdbcDriver, name, description, [connectUrl], [username], [password], [props], [validationQuery], [maxConnections])

  • Parameters

String jdbcDriver - The name of the JDBC driver configuration to use. Available options are based off the JDBC driver configurations on the the Gateway. 

String name - The datasource name. 

String description - Description of the datasource. [optional]

String connectUrl - Default is the connect URL for JDBC driver. [optional]

String username - Username to login to the datasource with. [optional]

String password - Password for the login. [optional]

String props - The extra connection parameters. [optional]

String validationQuery - Default is the validation query for the JDBC driver. [optional]

Integer maxConnections - Default is 8. [optional]

  • Returns


  • Scope

Gateway, Vision Client, Perspective Session

Code Examples
Code Snippet - Adding a MySQL Database to a Gateway
system.db.addDatasource(jdbcDriver="myJDBCDriver", name="NewDatabase", 
connectURL="jdbc:mysql://localhost:3306/test", username="root", 
password="password", props="zeroDateTimeBehavior=convertToNull;")

system db addDatasource, db.addDatasource