Using 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.

Hi;

I have done some checking through the filesystem and located where the problem is occurring. It is in the connection file, c:\xampp\htdocs\knights\dmxConnetlib\lib\db\Connection.php, line 36. The software is looking for the connection string to the database. What is interesting is that any web page that has been previously developed works fine as long as there are no changes made to it. The error condition only occurs when building a new web page or editing and existing page. You can build a new web page pointing at an existing data table that works but if I build a new table and use it in a new page the error condition occurs.

So what did I do today.

I went to a backup made a couple of weeks ago when I did not have this problem. Everything from the backup works but again if a new page is constructed and pointed to the database the error condition occurs.

I developed a new website locally with a new connection name pointing to the original database file called ‘knights_database’. I built a new web page in this website and tested within Wappler and through a browser. The result is the same error condition as the original website.

I reload the XAMPP application on my computer. Set it up to to the database locally. I then tested the new page on the new website in Wappler and web the browser, the same error condition.

I reloaded the Wappler application, tested the web page in Wappler and the browser, the error condition happens.

I’m not sure what to do next? Do you have any ideas how to fix the problem? Please let me know as I am getting frustrated and losing time to get the website built.

Thank you for your assistance.

Jim

From the description, it is very difficult to understand what exactly you are doing wrong and at what point the problem occurs. To help you figure this out, I recommend that you record a video of your workflow in detail, starting with setting up the connection and ending with the actions that cause the problem.

To record in gif format, you can use https://www.screentogif.com/ or analogs.

1 Like

Sorry Jim it’s really unclear what your workflow is. Your posts are confusing and we can’t understand what exactly are you doing.

The workflow for defining database connections per different targets in your site is quite simple:

You do that once only and then when your target is switched, it uses the connection defined for it.

Hi;

I have used the screen capture tool to follow of the build of a new page on the website. First tested the connection to connection1 whic connects to the knights_database. Next built a sever connect called test_new pointing a data table called test. Next built a application using the server connect pointing to the test_new. Placed a bootstrap4_table pointing to the server connection. As you can see in the example after the table is built it show no data just column headings. In the phpMyadmin tool I show you that there is a record in the table. Running the page through the web browser it causes an error 500. The trail shows you the error that I am getting.

I can open an previously built page before the problem. Here you can see that the database records are display from the contacts table. Constructed the same way making a simple call to the data table ‘contacts’ within the in the server connect side. On the application side, the same construction was used with a data connect pointing to the server connect called read_all. A bootstrap4_table was constructed using the data connect. The result is exactly what is expected the full contents of the table. Here is the process.

Hopefully you can see my problem. Please let me know if you need anything else.

Thanks;
Jim

1 Like

There is one very important aspect.

If you want to work on remote targets as well - you need to define on them “direct” connection as well as this will connect to the remote database and fetch the schema.

Then when opening a query when the remote target is selected, it will have the schema for it and won’t warn you about the missing fields.

I will see if we can auto enable and copy the connection options, when creating new targets

OK, got that change. It still did not fix my problem. I still get the same error when trying to build a new page using the local connection. Please help me.

Thanks
Jim

Can someone please help resolve this issue? Please I cannot develop anything due to this error condition. Thanks!

Hi;

I have done more testing to try and figure out where the problem is and it appears to be when making a new server connect. I opened a new page, used a previously existing sever connect applied it on the application side with a data connect action then used a bootstrap 4 table generator to display the contents of a data table. This procedure worked fine.

I went back and created a new server connect, pointing to the same table, on the application side I created a new data connect pointing it to the new server connect. Created a new generator 4 bootstrap table using the new data connect and there is no data seen under the table header.

I can repeat this operation over and over. Could you please take a look at the coding for me?

Thanks
Jim

Why are you adding a database connection step in the server action?
You only need to define it under GLOBALS and then in your server action add just a database query step … that’s all. Don’t add a database connection step in the server action!

I really lost track of what are you doing and what issue are you trying to explain your topic. It is really easy:

then