# Local Database using json idea

**URL:** <https://forum.xojo.com/t/local-database-using-json-idea/19347>\
**Category:** Databases\
**Created:** [September 19, 2014, 1:05am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347 "2014-09-19T01:05:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 19, 2014, 1:05am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/1 "2014-09-19T01:05:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Phillip\_Zedalis](https://forum.xojo.com/user_avatar/forum.xojo.com/phillip_zedalis/32/1151_2.png) [@Phillip\_Zedalis](https://forum.xojo.com/u/Phillip_Zedalis)\
**Post date:** [September 19, 2014, 1:21am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/2 "2014-09-19T01:21:27Z")

</div>

That is essentially what cubeSQL does.

---

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 19, 2014, 1:35am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/3 "2014-09-19T01:35:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wayne\_Golding](https://forum.xojo.com/user_avatar/forum.xojo.com/wayne_golding/32/165_2.png) [@Wayne\_Golding](https://forum.xojo.com/u/Wayne_Golding)\
**Post date:** [September 19, 2014, 4:09am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/4 "2014-09-19T04:09:02Z")

</div>

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.](http://www.macdevcenter.com/pub/a/mac/2004/11/19/realbasic.html) It’s a bit old at 10 years, but gives you a good start on creating a server using Xojo.

---

<div class="post-metadata">

**Author:** ![Paul\_Lefebvre](https://forum.xojo.com/user_avatar/forum.xojo.com/paul_lefebvre/32/3152_2.png) [@Paul\_Lefebvre](https://forum.xojo.com/u/Paul_Lefebvre)\
**Post date:** [September 19, 2014, 1:09pm UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/5 "2014-09-19T13:09:35Z")

</div>

> [@130349:@Tom Duncan](#):
>
> Is cubesqql available for people who have not purchased the full database version of xojo?

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

---

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 19, 2014, 8:23pm UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/6 "2014-09-19T20:23:32Z")

</div>

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

Tom

---

<div class="post-metadata">

**Author:** ![Wayne\_Golding](https://forum.xojo.com/user_avatar/forum.xojo.com/wayne_golding/32/165_2.png) [@Wayne\_Golding](https://forum.xojo.com/u/Wayne_Golding)\
**Post date:** [September 20, 2014, 6:11am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/7 "2014-09-20T06:11:40Z")

</div>

> [@130342:@Tom Duncan](#):
>
> Any source code examples etc. would be very happily accepted.

[here you go.](https://dl.dropboxusercontent.com/u/18858366/SQLiteServer.xojo_binary_project)

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

---

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 20, 2014, 6:36am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/8 "2014-09-20T06:36:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 20, 2014, 7:45am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/9 "2014-09-20T07:45:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Wayne\_Golding](https://forum.xojo.com/user_avatar/forum.xojo.com/wayne_golding/32/165_2.png) [@Wayne\_Golding](https://forum.xojo.com/u/Wayne_Golding)\
**Post date:** [September 20, 2014, 11:19am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/10 "2014-09-20T11:19:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 20, 2014, 11:31am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/11 "2014-09-20T11:31:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andre\_Kuiper](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/e9bcb4/32.png) [@Andre\_Kuiper](https://forum.xojo.com/u/Andre_Kuiper)\
**Post date:** [September 20, 2014, 1:51pm UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/12 "2014-09-20T13:51:26Z")

</div>

[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.

---

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 20, 2014, 10:31pm UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/13 "2014-09-20T22:31:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wayne\_Golding](https://forum.xojo.com/user_avatar/forum.xojo.com/wayne_golding/32/165_2.png) [@Wayne\_Golding](https://forum.xojo.com/u/Wayne_Golding)\
**Post date:** [September 20, 2014, 10:45pm UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/14 "2014-09-20T22:45:30Z")

</div>

[As promised](https://dl.dropboxusercontent.com/u/18858366/SQLClient.xojo_binary_project)

---

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 20, 2014, 10:53pm UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/15 "2014-09-20T22:53:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wayne\_Golding](https://forum.xojo.com/user_avatar/forum.xojo.com/wayne_golding/32/165_2.png) [@Wayne\_Golding](https://forum.xojo.com/u/Wayne_Golding)\
**Post date:** [September 20, 2014, 11:12pm UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/16 "2014-09-20T23:12:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 21, 2014, 1:16am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/17 "2014-09-21T01:16:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 21, 2014, 4:14am UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/18 "2014-09-21T04:14:40Z")

</div>

Have done a little playing.  
To run these examples just put the sqlite database into the folder that has the server.  
[Client & Server](https://xojo.io/f78f8b4d5e75)  
Hope the link works. lol

---

<div class="post-metadata">

**Author:** ![Tom\_Duncan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/278dde/32.png) [@Tom\_Duncan](https://forum.xojo.com/u/Tom_Duncan)\
**Post date:** [September 21, 2014, 1:11pm UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/19 "2014-09-21T13:11:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wayne\_Golding](https://forum.xojo.com/user_avatar/forum.xojo.com/wayne_golding/32/165_2.png) [@Wayne\_Golding](https://forum.xojo.com/u/Wayne_Golding)\
**Post date:** [September 21, 2014, 6:47pm UTC](https://forum.xojo.com/t/local-database-using-json-idea/19347/20 "2014-09-21T18:47:24Z")

</div>

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

My original was developed on Windows.

[Next page](https://forum.xojo.com/t/local-database-using-json-idea/19347.md?page=2)
