Skip to main content
Version: 8.1

system.db.addDatasource

This function is used in Python Scripting.

Description

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.

Syntax

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

Parameters

TypeParameterDescription
StringjdbcDriverThe name of the JDBC driver configuration to use. Available options are based off the JDBC driver configurations on the the Gateway.
StringnameThe datasource name.
StringdescriptionDescription of the datasource. [optional]
StringconnectUrlDefault is the connect URL for JDBC driver. [optional]
StringusernameUsername to login to the datasource with. [optional]
StringpasswordPassword for the login. [optional]
StringpropsThe extra connection parameters. [optional]
StringvalidationQueryDefault is the validation query for the JDBC driver. [optional]
IntegermaxConnectionsDefault is 8. [optional]

Returns

Nothing

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;")

Keywords

system db addDatasource, db.addDatasource