Modify Database Connection Strings through Scripting

I have a remote application that creates multiple databases on a monthly basis and writes to a SQL Server. I have no control over this but I would like to bring the data into ignition. I need to be able to modify the connection string for a database connection so that it points to the new month DB. I would like to automate this so we don’t go to the Gateway to update the database name for the connection. Does anyone have any ideas on how to do accomplish this?

take a look at the ialabs scripting module, you may be able to do this


You might be able to do this using the system.db.setDatasourceConnectURL function. This may only work for SQL databases where the database name is included in the URL.

If you are using a MSSQL database then you may want to use the db.removeDatasource and then create a new datasource connection using db.addDatasource. Reason being is the MSSQL database connection has an extra connection parameter where the database name is specified.

Hope this helps.