Local Database using json idea

Hi All,
I am a newbie to xojo, so please excuse what I write.

I would like to setup a simple database server.
My idea is.
Have my server connected to an Sqlite database.
Then have a client connect to the server via tcp or udp and they would send a sql query.
The sever would then create the json string and then broadcast this back to the client.
The client would then read the json string and update his local Sqlite database.

Has anyone any thoughts on this and any methods to get this done.
I am confident with Delphi but xojo is a new beast to me.
Any source code examples etc. would be very happily accepted.

Tom Duncan
Australia

That is essentially what cubeSQL does.

Is cubesqql available for people who have not purchased the full database version of xojo?
I have just the basic Mac only one.

Hey there Tom - welcome to the community. I don’t know if you need any special license to access CubeSQL - I don’t use it.

But if you want to proceed with your plan as a learning exercise I’d be happy to help. To start with you might want to look at this article. It’s a bit old at 10 years, but gives you a good start on creating a server using Xojo.

You do need a Xojo Database Server Access license in order to use CubeSQL with it.

Thanks for that.
I am pushing ahead with the JSON idea.
Will make the code available to all when I have finished.

Tom

here you go.

You’ll need to look at the App open event and adjust to suit your database file location. The server listens on port 1996.

Thanks so much for that Wayne.
Sorry to be a pain but have you the client side as well. (don’t ask for much do I. lol)

Tom

Have tried using the Client side from the demos. (and using the correct port)
It does show connected but the server does not seem to get the sql that I send to it.

I was testing it using telnet. Will do a client side tomorrow.

Thanks so much for your help.
Hope the election is going your way.
Tom

[quote=130601:@Tom Duncan]Have tried using the Client side from the demos. (and using the correct port)
It does show connected but the server does not seem to get the sql that I send to it.[/quote]

Probably you have to add a EndOfLine to the sql before sending.

Thank you, did that and works like a dream.
I can now continue with the demo app.

As promised

Thank you so much.
Works like a dream.
Now I can figure what you did.

You’re welcome Tom. It gives you some idea of just how powerful Xojo is when you can build client & server applications with just a few lines of code.

Thanks again for your help.
I have started an eddie demo for testing purposes.
Sofar have the name selection then Client details displaying.
Had hassles with the blob field so will wait for later to get that to work.
But thanks again, I will make the demo available for anyone to play and fix (my early xojo coding)

Tom

Have done a little playing.
To run these examples just put the sqlite database into the folder that has the server.
Client & Server
Hope the link works. lol

Just tested the demo with the server on Windows.
Just in debug mode since I only purchased the MAC version (must change that)
Anyway with two debug version running with the client and server all was well under Windows 7
However, when I ran the MAC version of the client with the correct IP address it connected but no response.
Tried it the other way around, the server on the MAC received the the query but no response.
I have given firewall OK for the correct port in and out on windows and the MAC has firewall turned off.

Any ideas anyone.
Tom

Is the windows machine physical or virtual? Can you ping the windows machine from the Mac?

My original was developed on Windows.