Android Question B4A app unable to connect to local MariaDB

toby

Well-Known Member
Licensed User
Longtime User
I have published some apps with MariaDB as backend database and now I need to setup WAMP on my local laptop for future development of those apps. I only want the WAMPServer works locally, so I assume that firewall shouldn't be an issue.

I've basically followed this tutorial step by step; the only difference is that the tutorial calls for XAMP while I use WAMPServer 3.2.26 which has been installed recently.

The only thing that doesn't work is that B4A app trying to connect to the DB resulted in timeout when adding a new person. I didn't change the persons.php file. I'm wondering how others solve the problem. Thank a lot in advance.

B4X:
Sub InsertNewPersonButton_Click
 
    If NameET.Text.Length<2 Then
       Log("Name is missing or to short")
       Return
    End If
 
    If AgeET.Text = "" Then
       Log("Age is missing")
       Return
    End If
         
    Dim InsertNewPerson As HttpJob
    InsertNewPerson.Initialize("InsertNewP", Me)
 
    InsertNewPerson.download2("http://" & ServerIP & "/persons/persons.php", Array As String ("action", "InsertNewPerson", "name", NameET.Text, "age", AgeET.Text))
    'InsertNewPerson.GetRequest.Timeout=40000
 
    Wait For (InsertNewPerson) JobDone(j As HttpJob)

    If j.Success=False Then
        Log(j.ErrorMessage)
        ToastMessageShow("No internet connection", True)
        j.Release 'no internet
        Return
    End If
    Log(": j.GetString=" & j.GetString)
End sub
This is filtered logs:
Unfiltered logs:
modified test app attached
 

Attachments

  • b4a_app_xampp2.zip
    9 KB · Views: 114
Solution
WAMPServer 3.2.6 comes with Mysql and MariaDB, both of them are installed and were selected on my computer. It finally works after I deselected Mysql as shown in the attached image

MicroDrie

Well-Known Member
Licensed User
The old procedure said
Open your browser and type: 127.0.0.1. Chose you language and click on "Status". Here you can see which "services" are working:
By using the address 127.0.0.1, the nowadays internal strict Windows Firewall is bypassed. If your program code do not use this 127.0.0.1 address in the variable ServerIP traffic is blocked and a time error is the result. Check your firewall if all used ports are opened fro the ip-addresses for your app.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I only want the WAMPServer works locally, so I assume that firewall shouldn't be an issue.
It IS an issue if the php can not be reached. The php must be accessible from outside otherwise it will not work.
You firewall have to be open on some ports (all needed).
 
Last edited:
Upvote 0

teddybear

Well-Known Member
Licensed User
Upvote 0

PaulMeuris

Active Member
Licensed User
You could use as ServerIP your local IP address and the correct port. Check the Apache settings of Wampserver, Xampp or Uwamp.
Uwamp: 192.168.1.190:443 (replace IP with your info)
Xampp: 192.168.1.190:80
Your local IP address of course can be find using the command prompt from Windows: ipconfig /all
 
Upvote 0

toby

Well-Known Member
Licensed User
Longtime User
WAMPServer 3.2.6 comes with Mysql and MariaDB, both of them are installed and were selected on my computer. It finally works after I deselected Mysql as shown in the attached image

 
Last edited:
Upvote 0
Solution
Cookies are required to use this site. You must accept them to continue using the site. Learn more…