B4J Question Replacing an apache/mysql server

mc73

Well-Known Member
Licensed User
Longtime User
Here's the story: In an app I have I connect androids with an apache/mysql server. So far so good.
Now, I am thinking that the php code I'm using at the server side, can easily be found and perhaps modified by users. At least at local servers. For web solution I have no problem since I'm hosting it.

I'm thinking of another approach: Setup a small server using b4j, then let it handle all incoming connections. Then, I'll let this server perform all necessary queries. This won't be a problem, even though I have some small concerns about simultaneous writes. But if I'm going to do this, I'm then thinking on why to stick with mysql and not have a sqlite database, since it is not a heavy db. Any thoughts on this will be greatly appreciated, thank you :)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Ty Erel.
My thought was to have the app as independent as possible, ie avoiding a wamp installation.
Now I notice the jetty server. My original thought was to get my own android server and set it to work using b4j. I'll go check the jserver, does it have the option to work with streams? I would prefer to not alter the client's code.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Jetty server is just a library inside your app. There is no server to maintain. The B4J itself is the server.

What do you mean with streams? You can read binary data from the connection. However the communication is done in a request / response fashion.

Once you get used to this you will see that it is very powerful and much simpler to maintain.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
I don't disagree, I already run such servers.
The thing is that one can choose a pc based server, the other an android.
Since the client code for the latter case is there and stable, I would choose to not alter it. From what I saw, b4j has a server object and asynchronous streams. So perhaps I can avoid rewriting.
Anyway, I'll get into jserver and see if there's not much work involved in "transfering" :)
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Checked jserver, queried an sqlite db from 4 androids simultaneously, this is fast, man, deserves the time to alter the code, thanks again :)
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
update: since I originally had an additional mysql handler, the trick was to send the request almost the same way, so everything went pretty well.
Just a short note: greek characters were not showing correctly. I had to add
B4X:
resp.ContentType = "text/html;charset=UTF-8"
. Just in case anyone else gets the same problem.
 
Upvote 0
Top