Define Database Connection Settings per Target

Intro

When working on different targets, for example development and production, they usually have different addresses, database names, usernames and passwords. With Wappler you can easily define different database connection settings for your different targets.

Setup Database Connection

As you know, the active target you are working on can be selected using the Target menu:

Our project has two different targets - the local development target and the remote server which is our production target:

We set our active target to the development one i.e. the local server we are working on. Right click the Database Connections under Globals in Server Connect panel:

Add a new Database Connection:

Add a name for it and click the Connection Options button:

We enter the database connection details for the selected target - in our case this is our local server (development). Then click Save:

And your database connection details for this target are now saved, so you can use the database connection.

Now, we open the Target menu and select the remote target / production:

Click the Connection Options button:

And change the database connection details per this target. In some case they might be the same, in others the address, username and password can be different per different targets. So change them accordingly:

Click Save and you are done:

That’s how you can have different database settings for each of your different targets.

1 Like