Using Database Connection

I need to get some help with database connections. I recently moved my website to an online server. Changed the server connection to point to the correct location using the server connection app. I can view the tables in the docker app but when I use these tables on the client side no data appears on a simple request form.

Following the code I am receiving the following error

serverconnectForm.js:262 POST https://knights-parker-7880.org/dmxConnect/api/BE_act/login/log_in_action.php 500 (Internal Server Error)

Can someone please give me some help?

Thanks;
Jim

Please follow:

Thank you for your assistance. I have followed the trace and can see what the problem is but not sure how to correct it within the Wappler app.

What I did was made a new database connection which I called connection_online. This connection was saved with the correct parameters for the online server. It worked as I could see all the tables in Wallper. The next thing I did was to rename this connection to the name used when I created the entire website locally on my computer (connection1). The reason I did this is because all the developed pages were pointing to that name. If you look at the uploaded trace the software is confused as part of it is looking at the local database connection (Access denied for user ‘root’@‘localhost’. (using password NO). The next attachment show the new database connection which is built cia the Wappler app.

It shows a user name as knight91_database. So I think the software must be confused on what connection to be used. I hope this description helps to understand what has gone wrong. Is there any easy way to correct this problem?

Thanks;
Jim

Hi, I was wondering if you had an idea on how to solve the problem? If you need any additional information please let me know.

Thanks;
Jim

If you need to setup different db connections per different target, change the target from the target menu, open the global connection settings and enter the details per target.

Teodor;

I did do that but how do I update my pages developed to point to the new target? Do I need to go into each page and change the database connection to the new target?

Please let me know.

Thanks;

Jim

You don’t update pages.
You only need to do this once … for the global connection.

  1. Select your local target from the targets menu
  2. Open global connection options in server connect
  3. Enter the local target database details, click save.

then

  1. Select your remote target from the targets menu
  2. Open global connection options in server connect
  3. Enter the remote target database details, click save.

do this for all the targets you need.

Teodor;

OK I have done that but I still an error.

  1. code: 1045

Help!

Where and when do you get this error?
Are you sure your server actions / db queries are using the globally defined connection?

Teodor;

Let me explain to you what I have done. I fully developed the website on my local machine. All the web pages were built with a connection labeled ‘connection1’. When they were built the Target Name was ‘knights_data’. The pages were tested thoroughly and everything worked fine.

I just selected local on the targets menu and built the server connection for my machine with the Use Direct Connection selected and click on the Direct Database Connection button. Here is the screen copy of

Next I pointer the Target to knights_data (the name of the database). I changed the settings by unselecting the User Direct Connection button and then clicking the Server Connect Connection. Completed the screen below as the picture below shows.

Both connections were tested with the Test button and both worked fine. When I try the website on my machine I get

ile: “C:\xampp\htdocs\nights\dmxConnectLib\lib\db\Connection.php”`

line: 99

message: "SQLSTATE[HY000] [1045] Access denied for user ‘knight91_database’@‘localhost’ (using password: YES)"

**trace: "#0 C:\xampp\htdocs\knights\dmxConnectLib\lib\db\Connection.php(99): PDO->__construct(‘mysql:host=loca…’, ‘knight91_databa…’, ‘W.2PoHeA-1BJ’, Array)****↵#1 C:\xampp\htdocs\knights\dmxConnectLib\modules\dbconnector.php(12): lib\db\Connection->__construct(Object(lib\App), Object(stdClass), ‘connection1’)****↵#2 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(193): modules\dbconnector->connect(Object(stdClass), ‘connection1’)****↵#3 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(157): lib\App->execSteps(Object(stdClass))****↵#4 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(127): lib\App->execSteps(Array)****↵#5 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(116): lib\App->exec(Object(stdClass), false)****↵#6 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(94): lib\App->exec(Object(stdClass))****↵#7 C:\xampp\htdocs\knights\dmxConnect\api\BE_act\login\log_in_action.php(8): lib\App->define(Object(stdClass))**↵#8 {main}"

Then when tested online I get the following

  1. code: 1045

I tried to run a trail on both instances.

Please let me know if you need any additional information.

Thanks;
jim

Teodor;

Theses errors are seen when I attempt to activate the Login page. As soon as the login information is entered the user clicks on the Login button then the error appears in the log. Either locally on my computer or on the web hosting location. This problem started when I made a change to the connections in the Server Database Connect screen.

Would it help if I gave you direct access to my computer? Please help me as I cannot continue to develop until this issue is resolved.

Thanks;

Jim

Can someone please help me. I am still getting errors connecting to both my local development machine and the remote site. I cannot proceed until this issue is resolved. Thanks

I’m a newbie to Wappler, but is your server allowing remote MySQL connections?

Shawn;

I think so but you tell me how I can confirm that?

Thanks;

Jim

Check the following:
000006-2020-11-27 14_14_11-11-

Set bind-address to 0.0.0.0 and restart mysql using:

systemctl restart mysql

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?