system.db.addDatasource
Adds a new database connection in Ignition.
system.db. addDatasource( jdbcDriver, name, description, connectUrl, username, password, props, validationQuery, maxConnections )
-
Parameters
String jdbcDriver - The name of the JDBC driver in Ignition. Required.
String name - The datasource name. Required.
String description
String connectUrl - Default is the connect URL for JDBC driver.
String username
String password
String props - The extra connection parameters.
String validationQuery - Default is the validation query for the JDBC driver.
Integer maxConnections - Default is 8.
-
Returns
Nothing
-
Scope
All
#The following code would add a MySQL connection to the Gateway.
system.db.addDatasource(jdbcDriver
=
"MySQL ConnectorJ"
, name
=
"MySQL"
,
connectURL
=
"jdbc:mysql://localhost:3306/test"
, username
=
"root"
,
password
=
"password"
, props
=
"zeroDateTimeBehavior=convertToNull;"
)