How to use the new database connection methods

We’ve seen some fairly major changes to the database functionality so I want to check the best practices for setting up connections to make sure I’m doing things correctly.

Let’s assume I have a hosting server which allows a connection to the MySQL database via localhost. If I want to connect directly to that database from my computer then I have a different set of login credentials but my app wants to use localhost when live.

Should I create two connections in globals, one via localhost and one via the IP address? Would this give me the ability to use the Database Manager fully as it’s using the IP connection but still use localhost when live?

Could someone explain the methods and best approaches to this?

You just create one connection, in server connect globals database connections and give it your localhost credentials as this will be used on your web server.

It will auto create also a direct connection for Wappler with the same credentials, but you can just edit it in the database manager and give it the correct credentials for remote access.

So in short one connection with just different credentials.

You can also have different credentials per target if you want. But the connection name is always remains there same.

1 Like

Thanks @George. That makes sense. Any reason why Wappler allows you to create more than one connection?

Well some people use more than one database, but indeed most of the time you will have just one.

1 Like

Aah, of course. Should’ve thought of that! :upside_down_face: