Database Replacements

Cloud_Bus_Ent.png

Database replacement lets you change database connections for your labels, solutions, and Automation configurations when switching between multiple database servers.

Database replacements enable you to configure solutions in development environments and run those solutions in production environments without any database configuration changes inside the solutions.

[Note] Note

To configure database replacements, you must log on to Control Center as an Administrator.

Database connection string replacements let you configure solutions where parts of database connection strings change while solutions run with connected databases. After running database connection string replacements, your solution still uses the unchanged database configuration, but with a connection to a different database server.

You can use the database replacement option with all types of databases:

  • SQL

  • Oracle

  • MariaDB / MySQL

  • Access

  • Excel

  • CSV and other text files

[Note] Note

Database replacement is possible with solutions and configurations that run in LoftwarePrint, Loftware Web Client, and Automation.

Configuring database replacements define your "from-to" replacement pairs. Each replacement pair contains Value from and Value to elements. During actions, Value from strings becomes Value to strings. The number of replacement pairs is not limited.

  1. To add new database replacements, open Control Center and go to Administration > Database Replacements.

  2. Click Add+. The Database replacements page opens.

  3. Type the Replacement name. Make the name descriptive so you can easily find the replacement later.

  4. The Find text field lets you search for the existing From element of the replacement pair. This is the database connection string you are replacing.

  5. Type Replace with. This is the <To> element of the replacement pair. This is your final database connection string.

  6. Click Save. Your new replacement is active and listed on the Data replacement page.

[Note] Note

After you click Save, database replacements require up to 10 minutes to take effect.

Example 28. Example

Your action in Automation connects to mySQLServer and myDatabase. You want to update your database connection string to use the database NEW_myDatabase on the server NEW_mySQLServer.

You must define two replacements – the first changes the server name, and the second changes the database name.

1. Add the first replacement and name it Server name replacement.

2. Type in the Find text field: Data Source=mySQLServer

3. Type in the Replace with field: Data Source=NEW_mySQLServer

4. Add the second replacement and name it Database name replacement.

5. Type in the Find text field: Initial Catalog=myDatabase

6. Type in the Replace with field: Initial Catalog=NEW_myDatabase


[Note] Note

All database replacements are encrypted in the Control Center database. This ensures the secure replacement of sensitive data, such as user names, passwords, and network addresses.

Database replacement ensures that your solutions and configurations connect to the right databases both in a test environment and in production.