Wappler’s powerful visual server-side tools allow you to easily connect to your Database in a few clicks.
Before you create your databse connection, make sure to check HOW TO SETUP FTP CONNECTION and setup your target and select it, as this is required for the Database Connection.
It is really easy to connect to your database, using Wappler. The first thing you need to do is to open the Server Connect panel:
If you have not selected your server model when defining your project, then you will see a message saying that you need to specify one. Click the project options button:
Open the server model drop-down and select one - PHP, ASP.NET or Classic ASP:
In order to connect to a database, we also need to SETUP A TARGET so please do this before you continue with the tutorial.
When you select a server model server connect shows you the toolbar and panels. The first thing you need to do, is to create a Server Action. Server Actions store your workflows, and execute the steps you visually set up.
The toolbar allows you to create a server action, create a folder or delete a server action/folder. For a better structuring especially on large sites, using many server actions we recommend to group your server actions in folders. We create a new folder:
We call it “data”. Inside it we create a new server action:
We add a name for it: “records”
When you create the server action you will see the action steps panel, with its options. Right click steps in order to add a new step:
We open the database actions menu:
Then we Add Database Connection:
Before clicking the database connection options, we need to make sure we selected the right target. This is the target we’ve already setup earlier:
Click the Connection Options button:
The Database Connection options window appears. Select your database type:
Then the database options will be displayed. Enter the sever address, port, username, password and database name:
You can test the connection by clicking the Test Connection button. If everything is OK you will see the Connection OK notification:
Click the Save button, in order to apply the connection settings:
You can see your connection in the server action. The blue link button after the connection name means that this connection is linked to your current site and you can reuse it in all of your action files by just loading it using the folder button:
Click the Save button in order to save your server action:
You will see a notification saying that the server action has been successfully saved: