Using Database Connection

Shawn;

( am working in the windows platform running xampp app and building the database through phpMyAdmin locally. I can make a single connection to myself but try to use Wappler making a connection to my remote system using the same connection name is where things break. I must be doing something wrong with the GUI application? I can make a connection to the hosting server but when using the connection to the remote server all communication fails.

Please let me know if you have any idea to connect to both at the same time.

Thanks;

Jim

Hi Jim

Tell us which hosting and which xampp you use. If I have time on the weekend, I’ll try to connect to them, and then I can write you more specifically what needs to be done.

Mr. Rubi;

Thank you for your assistance. Here is the information and the procedure I have.

First the software and remote hosting location.

XAMPP – version 3.2.4

myPhpadmin – 10.4.11 Server Type MariaDB Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.2.31 Database client version lbimysql – mysqlnd 5.0 12-dev - 20150407

PHP version 7.2.31

Web Hosting location – Inmotion (inmotionhosting.com)

Wappler version (latest downloaded yesterday)

Here is the procedure I am doing. I built an entire website locally on my machine and built a local connection which pointed to the local database called knights_database. The connection name is called connection1. The parameters were simple using the account root with NO password. The connection worked fine.

I

I built an interface (target) called remote_database_connection. Here is the project settings for the remote.

FTP password is W.2PoHeA-1BJ

To use the same connection name in the Database Manager I clicked the target called remote_database_connection then clicked the Connect Connection button. The remote server information is.

The database on the remote server is knight91_database. The password for the database is Knights7880.

Now everything fails both the local connection and the remote connection do not work meaning that when I check a page called login.php it does not work in either local nor remote. When I go to the local URL (localhost/knights/admin/login.php) here is what the error logs:

Here is the error log for the remote URL (knights-parker-7880.org/admin/login.php)

Looking at the error logs it appears to me that the local connection is using the remote connection information and the remote connection is using the local connection information? I most likely did something wrong in the Wappler GUI? Please let me know how to correct it.

Thanks;
Jim

I can’t connect yet, but I’ll try to help without connecting.

So, if I understand correctly, you first created a local target and developed the project locally. At the same time, everything worked correctly and there was a connection with the database. Then, you created a second target for hosting, along with a connection to the database hosted on the hosting, and after hosting, the connection to the database does not work.

If I understand you correctly, check the following steps:

  1. For each target that you created in the project settings:


    Must be created database connection (these connections can be any number each target):

  2. Inside each of the server action, you must choose the desired database connection from those which you created in the appropriate target:

PS I didn’t think you put all the connection data in open access. I hope that these are the details for the tests. In any case, after the problem is resolved, I strongly recommend changing all the hosting details.

So what I tried to do is use the same connection name ‘’connection1’ for both a local and remote connection? You cannot do this in wappler?

@jdamrau, it is not clear from reading the posts whether or not you have the experimental features turned on or not. Could you check that?

If you already have them turned on, then what Teo said should work. He also posted a tutorial on how to use the global database connections on different targets in this post.

If you check to see if you have experimental features turned on and they are not turned on, please post and let us know that.

Scott;

This option was turned off. I have turned it on and there is no change to the behaviors.

I followed the step on this ticket and still have errors. The local connection (development target name)

show the following errors in the log file.

While going to the remote host (remote_database_connection)

I get the following log errors

It seems to me that the error logs are backwards?

Can you help resolve my problems?

Thanks;
Jim

Seems to me the credentials you use to access the database don’t have access. Maybe double check those.

I tried to connect to your server using your hosting details, but I couldn’t do it. Some problems with the hosting details that are specified in your settings. The first thing that catches your eye is the project directory:

Usually public_html is used on hosting services

Or, if you host multiple sites on the hosting site folder/public_html

Check your hosting details. You need to ensure that Wappler connects to the server via FTP without any problems. And only after that it makes sense to proceed to configuring the database connection.

Hi. Maybe you do not have the correct password? It does work as I tested it through wappler. I tested the ftp connection from a command line and I can see the ftp working in wappler when I click the the Check button.

If I allow you can you make a remote connection to my computer? This way you can move around to check things.

Please let me know

Thanks
Jim

I used the password that you specified to connect to FTP in the message above.

Even on your hosting site inmotionhosting, the connection documentation States that the project directory will be public_html when connecting via FTP:

When you click the Test Connection button in the settings, do you get the same connection result?

Hi

Yes I do get the connection ok. I might have given you the incorrect password. Sorry it is the ftp password is Knights7880. The path is also set to public_html. All seems to work on my side. Let me know what else can be done.

Thanks
Jim

Hi;

I think that I confirm that after setting up the database connection for local, I go back and change the name of the target to its correct remote name, save it and it changes the connection1 to the remote server address. If I go change the target to the local name and review the connection options it got changed to the remote information.

Try it. Maybe I am setting it all wrong?

Thanks;

Jim

@jdamrau do note that this is a public topic, so all security and login information you post is readable by anyone.

I do presume that you will change all the passwords when done and we can archive this topic.

So, everything works. There is a chance that you have configured something wrong for yourself. It may also be that you configured everything correctly, but encountered this problem:

It could create an error when you switched from a local target to hosting, but did not update the dependency schemas in the server action tables.

I show the result of simultaneous connection to different databases for different purposes and settings:

A few words about setting up the connection. As you can see from the video, at the beginning I have a connection to the local database. And the Direct Connection function is enabled in the settings. This feature allows you to manage the database directly from the Wappler database Manager. But on your hosting there is a restriction on external connection. So when I show the settings for connecting to the hosting database, this feature is disabled.

The video also doesn’t show the process of redefining dependency schemas. But this is a simple process. If you created a server action on, say, a local target, then when switching the target to hosting, you should go to this server action and you will see a warning window that you should define the schema. After you update the scheme, you can upload the site to hosting and everything will work.

Also remind. After you understand everything, be sure to change all the details on the hosting.

Hi;

Thank you!

I have reviewed your procedures and made sure I followed it. Question, do I need to delete anything in the public_html directory before I go and upload the entire site?

Please let me know.

Jim

Yes, of course. Since you will be hosting a different site, you need to completely clear the public_html folder. This should always be done when you want to upload a new site to the directory where some other site is located. If you don’t do this, you will first get a mess in the directory, and then 100% errors will occur.

Only if you are working on the same site, you can simply update the changes and upload new files. But with Wappler, you don’t have to worry about it, it does it for you automatically - it updates the current project files and loads the newly created ones. So you only need to control the situation when you want to upload a new site to a directory that is already in use.

Hi;

Good news the website works both remote and local. One problem I am having now is developing new material locally. It seems like the local connections is not working? Looks like the same error were getting yesterday?

trace: “#0 C:\xampp\htdocs\knights\dmxConnectLib\modules\dbconnector.php(12): lib\db\Connection->__construct(Object(lib\App), Object(stdClass), ‘connection1’)↵#1 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(193): modules\dbconnector->connect(Object(stdClass), ‘connection1’)↵#2 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(157): lib\App->execSteps(Object(stdClass))↵#3 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(127): lib\App->execSteps(Array)↵#4 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(116): lib\App->exec(Object(stdClass), false)↵#5 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(94): lib\App->exec(Object(stdClass))↵#6 C:\xampp\htdocs\knights\dmxConnect\api\BE_act\test.php(8): lib\App->define(Object(stdClass))↵#7 {main}”

Any ideas how this can be fixed?

Please let me know.

Thanks;
Jim

Unfortunately, I don’t understand what you’re talking about.

In the post above in the video, I clearly demonstrated that everything works fine. The video shows that the project runs perfectly on a local xampp server with a local database. It also works perfectly with a remote target in the form of your hosting with a database hosted on this hosting.

In other words, I didn’t have any problems working on the local server + local database, or on the hosting server + database on this hosting.

Possible problems can only occur if you make a connection error, or if you are developing on one target and then forget to update the dependency schemas in the server actions when switching to another target.