Android Question Accessing online database - Best Approach?

tsteward

Well-Known Member
Licensed User
Longtime User
Yes I have searched and there are a million threads on this which becomes confusing.

At the moment I have an online database for people to register my app as follows:
B4X:
Sub regLicense
    Dim Register As HttpJob
    Dim mail, name As String
    name = manager.GetString("UsersName")
    mail = manager.GetString("UsersEmail")
    Register.Initialize("Register", Me)
    Register.download2("http://locksdownunder.XXX.com/register.php", Array As String ("Action", "RegisterPH", "UName", name, "Mail", mail))
End Sub

My php script does the database stuff end returns JSON formatted response which I deal with in jobdone:
B4X:
sub JobDone(job As HttpJob)
    Log("JobName = " & job.JobName & ", Success = " & job.Success)
        If job.Success Then
        Dim res, action As String
        Dim parser As JSONParser
        res = job.GetString
        parser.Initialize(res)
        Select job.JobName
            Case "Register"
                action = parser.NextValue
......
end sub

Now all this works fine for me.

My question is I now want my app to search other tables and return the results.
My app will provide the table name to search and the string and field to search.
Returned may be many records which if:
> 30 I will tell the user too many possibilities please refine your search.
< 30 I will display the results.

This is a text only database.
So my question is to I keep using the same method as used above and return the results using json format. (I have now idea what i'm doing.)

Or am I better of using RDC or similar.

Does anyone have the time or patients to help me here please?
 

edgar_ortiz

Active Member
Licensed User
Longtime User
In my experience (i have 4 app) that access remote databases.

The best approach is the way you are doing.

I use Mysql and Store Procedure to handle the data.

Regards,

Edgar
 
Upvote 0
Top