Sql Database

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Sql Database

Post by Quinton B. » Sat Jan 12, 2019 10:57 pm

Hello.

I'm trying to create a database for my app. Despite my many attempts at this. Each one has failed. I lost all my data as my hdd died. I'm installing a fresh version of Windows and an ssd. What I need to do:


1. Create a server on my PC either odbc, or MySQL.
2. Connection to the server from my Android app
3. Update data in my database through the Android app
4. Create data in my database through the Android app
4. Select data from the database through the Android app
5. Select, or update specific data within the database through the Android app

If someone could help me out with this that would be greatly appreciated.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Sql Database

Post by bogs » Sat Jan 12, 2019 11:54 pm

Well, I don't know if this would help you, or if your looking for something more like this for question 1.

The other questions I have no clue :|
Image

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: Sql Database

Post by Da_Elf » Sun Jan 13, 2019 1:52 pm

I've been a fan of local mySQL databases. Not sure how android works but my program on a microsoft surface links to the database on my PC as long as ive got the PCs IP address typed in and I'm on the same network.

I tried once to load up MySQL on my website which uses hostmonster as its hosting company but for me to use a computer running a livecode app to connect to it the computer had to have a static IP address so that i could log into the DB. A normal website on that server would use using "localhost" since its on the same server.

A work around i found was to create a PHP on the site which connects via local host. Then in livecode i ran the website using php "_GET" on the site to handle the info being sent.

Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Re: Sql Database

Post by Quinton B. » Tue Jan 15, 2019 6:21 am

On many instances I can connect to it locally and do everything I need to. But when I deploy the app (remote), it won't work. I need to set up MySQL on my PC to host a server in which allows remote connections from an IP address. Once this step is done, everything else falls similar to domino's. Thank you.

Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Re: Sql Database

Post by Quinton B. » Sun Jan 20, 2019 5:54 pm

How do I configure MySQL, my computer, etc to allow remote connection for my app?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Sql Database

Post by FourthWorld » Sun Jan 20, 2019 8:56 pm

Quinton B. wrote:
Sun Jan 20, 2019 5:54 pm
How do I configure MySQL, my computer, etc to allow remote connection for my app?
Are you sure you want to expose all the power of MySQL's rich language to the open Internet?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Re: Sql Database

Post by Quinton B. » Tue Jan 22, 2019 4:59 am

Indeed. I would like to, or you could just direct message me.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Sql Database

Post by FourthWorld » Tue Jan 22, 2019 5:52 am

I think I misstated my point there. Most folks use MySQL behind middleware like PHP, Python, Ruby, or LiveCode to provide an HTTP-based API for DB operations, limiting potential risks of exposing the DB itself to the open Internet.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Re: Sql Database

Post by Quinton B. » Tue Jan 22, 2019 7:20 am

Cool beans. How would I go about going through with that? Anything that will make the DB more secure I'm up for. Also, I was reading a few more articles on this subject. They said that I would have to enable port-forwarding on my router. How would I go about doing that?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Sql Database

Post by FourthWorld » Tue Jan 22, 2019 7:29 am

This tutorial from the good folks at HostM seems a good starting point:
https://www.hostm.com/tutorials/livecod ... iadb-mysql

These Lessons on LiveCode Sever will round out other details as needed:
http://lessons.livecode.com/m/4070
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Sql Database

Post by sphere » Tue Jan 22, 2019 1:27 pm

Don't forget there is also a Database part here:viewforum.php?f=12

and a simple tutorial for your basic Insert/update/delete stuff here:viewtopic.php?f=12&t=27521 using PDO whcih you could use for almost any type of database

Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Re: Sql Database

Post by Quinton B. » Wed Jan 23, 2019 4:54 am

Lol, I only have community plus. I don't have $500 to drop on the indy or business addition in order to get the LiveCode server. Back to my first inquiry how would I go about connecting directly to the MySQL server? This will only be a beta test for at max 10 people. Once the app shows that it can function, is when I will slam the $500 on the table whispering take my money LiveCode god. But in all seriousness, I need help allowing remote connections to the database, I can connect to it locally, but I'm unable to connect to it from another computer or application (my app).

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Sql Database

Post by sphere » Wed Jan 23, 2019 8:46 am

That's because if you have a server at a host somewhere (so not local) it does not allow connections from other IP's unless you add those IP addresses.
You can add your own ip address to the server to accept it. But then only you can get/send data to your database.
Now you don't want to do that, because you can't add every ip address that's available on the internet.
You also don't want to add a IP wildcard so anyone can enter your database without any sort of protection, it would then be open to the internet.
So you need to have some form of middleware like PHP or anything else.
This middleware needs to be in a folder on you server.
Now you point your app (desktop or mobile) to this middleware file. for example: https:www.yourwebsite.com/myconnectionfiles/getsomedata.php
Now your server/database sees your middleware as it's own and thus allows connection and data transfer.

So if you want to use PHP with PDO statements then check out the 2nd link in my answer above.
It's shows you how to use it to connect your app and allow any ip from anywhere to your database.

You could also use Richard's link using LC server, you can download LC server from downloads. I don't believe you have to pay extra's to use it to have a connection to your DB. If you are on a share host then it is not always possible to have lc server running on your server. Then you need PHP ore something else.

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 366
Joined: Tue Apr 10, 2012 9:18 am

Re: Sql Database

Post by ghettocottage » Wed Jan 23, 2019 3:34 pm

Livecode Server Community Edition is free to download and use and works just fine with databases. I have it running on four different servers for various projects.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Sql Database

Post by FourthWorld » Wed Jan 23, 2019 4:30 pm

All editions of LC going back several versions are available here:
https://downloads.livecode.com/livecode/

LC Community Edition's license (GPL) is a distribution license, so its terms only come into play when distributing your work. Unless you're distributing the server code itself for others to run their own servers, the GPL-governed Community Edition should be every bit as suitable as MySQL itself, which is also available under dual license, with most folks using the GPL-governed edition.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”