MySql database for app iOS and Android
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
MySql database for app iOS and Android
Hi,
After some months disappeared, i will try to finish my app.
So, the first thing i made is to create one account to can have one database in cPanel.
Once this is done, i would like to know how to connect with the database from my app (that should work for iOS and Android)?
The database is one MySql.
Thanks in advance!
Regards.
After some months disappeared, i will try to finish my app.
So, the first thing i made is to create one account to can have one database in cPanel.
Once this is done, i would like to know how to connect with the database from my app (that should work for iOS and Android)?
The database is one MySql.
Thanks in advance!
Regards.
Re: MySql database for app iOS and Android
Hi aebki
Be aware that most providers do NOT allow direct (your app <-> mysql) connection
to your database but require a "middle-ware" like PHP or Livecodes Server (your app <-> PHP/LC Server <-> mysql)!
Best
Klaus
just like the first example in the dictionary about "revopendatabase" suggests!aebki wrote:... i would like to know how to connect with the database from my app (that should work for iOS and Android)?
Be aware that most providers do NOT allow direct (your app <-> mysql) connection
to your database but require a "middle-ware" like PHP or Livecodes Server (your app <-> PHP/LC Server <-> mysql)!
Best
Klaus
Re: MySql database for app iOS and Android
Hi Klaus,
Thanks for your answer.
What does it mean the middle-ware???
I don't understand very well...When i asked what should i do to can have my database online, some months ago, for my app; it was suggested to me to have one account in on-rev to can host my database...
And now that i made this, it seems it is not enough...
So, can you tell me please what and how should i do the things to can connect with the database from my app and use the data i have in this database?
And about the revopendatabse, i have one question:
I think i have to use this one:
get revOpenDatabase("mysql", "www.example.com", "RatesDB", myUsr, myPass)
So my doubt is what i have to put in place of the parameter "www.example.com"??? as i said before my database is created now in the cPanel in the on-rev.
Regards.
Thanks for your answer.
What does it mean the middle-ware???
I don't understand very well...When i asked what should i do to can have my database online, some months ago, for my app; it was suggested to me to have one account in on-rev to can host my database...
And now that i made this, it seems it is not enough...
So, can you tell me please what and how should i do the things to can connect with the database from my app and use the data i have in this database?
And about the revopendatabse, i have one question:
I think i have to use this one:
get revOpenDatabase("mysql", "www.example.com", "RatesDB", myUsr, myPass)
So my doubt is what i have to put in place of the parameter "www.example.com"??? as i said before my database is created now in the cPanel in the on-rev.
Regards.
Re: MySql database for app iOS and Android
Hi aebki,
"middleware" means that your app will "connect" to a webservice like PHP or LC Server,
that webservice will connect to the actual database and will return/modify/update/delete
the records in the database.
As I said, you need to ask your internet provider/hoster if you can connect directly to your
database WITHOUT any middleware.
You need to replace "www.example.com" with the URL of your "home page", for me it would be "www.major-k.de"
Best
Klaus
"middleware" means that your app will "connect" to a webservice like PHP or LC Server,
that webservice will connect to the actual database and will return/modify/update/delete
the records in the database.
As I said, you need to ask your internet provider/hoster if you can connect directly to your
database WITHOUT any middleware.
You need to replace "www.example.com" with the URL of your "home page", for me it would be "www.major-k.de"
Best
Klaus
-
- Livecode Opensource Backer
- Posts: 447
- Joined: Mon Jan 23, 2012 12:46 pm
Re: MySql database for app iOS and Android
I believe that there are example "middleware" scripts for both LiveCode server and PHP in this thread:
http://forums.livecode.com/viewtopic.ph ... re#p124505
--Sefro
http://forums.livecode.com/viewtopic.ph ... re#p124505
--Sefro
Re: MySql database for app iOS and Android
Hi,
Thanks to both (Klaus and Sefro)!
My server is one from "on-rev".
Regards.
Thanks to both (Klaus and Sefro)!
My server is one from "on-rev".
So, my hoster is the same one as the LiveCode (except if i am wrong)...Do you think that it will need one middleware anyway or not?As I said, you need to ask your internet provider/hoster if you can connect directly to your
database WITHOUT any middleware.
Regards.
Re: MySql database for app iOS and Android
Hi aebki,
Best
Klaus
although I also have an ON-REV account, I have no idea, sorry.So, my hoster is the same one as the LiveCode (except if i am wrong)...
Do you think that it will need one middleware anyway or not?
Best
Klaus
-
- Livecode Opensource Backer
- Posts: 447
- Joined: Mon Jan 23, 2012 12:46 pm
Re: MySql database for app iOS and Android
I also have an on-rev account, but I'm also not sure if they allow direct connections. I think if you are going to be distributing this app to other users, then best practice would be to use some sort of middleware, as I believe it is more secure than hard coding your database credentials into the application.
--Sefro
--Sefro
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: MySql database for app iOS and Android
Hi aebki,
Take a look here;
http://forums.livecode.com/viewtopic.php?f=53&t=20956
It's not a detailed explanation but if you look into the modules (phpadmin, Remote MySQL) you should be able to figure it out.
And yes this is all done on an on-rev server via cPanel.
Simon
Take a look here;
http://forums.livecode.com/viewtopic.php?f=53&t=20956
It's not a detailed explanation but if you look into the modules (phpadmin, Remote MySQL) you should be able to figure it out.
And yes this is all done on an on-rev server via cPanel.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: MySql database for app iOS and Android
Thanks Sefro and Simon,
I would have like to be able to do what Sefro suggests me. But i am not sure i will be able...
So, if it is as Simon said, it should work directly ( that it arranges me as i am not very very 'pro' with PHP ).
So when i create my account on 'on-rev' and i entered in cPanel first time, i had one message that i have one website: "www.mywebsite.on-rev.com" or something like this...then i created one database and one admin user.
So if i adapt what the dictionary says about revOpenDatabase:
revOpenDatabase("mysql", "www.example.com", "RatesDB", myUsr, myPass)
with
put 'myadminuser" into myUsr
put 'mypassword1234' into myPass
revOpenDatabase("mysql", "www.mywebsite.on-rev.com", "myDatabase", myUsr, myPass) it should work?
Regards.
I would have like to be able to do what Sefro suggests me. But i am not sure i will be able...
So, if it is as Simon said, it should work directly ( that it arranges me as i am not very very 'pro' with PHP ).
So when i create my account on 'on-rev' and i entered in cPanel first time, i had one message that i have one website: "www.mywebsite.on-rev.com" or something like this...then i created one database and one admin user.
So if i adapt what the dictionary says about revOpenDatabase:
revOpenDatabase("mysql", "www.example.com", "RatesDB", myUsr, myPass)
with
put 'myadminuser" into myUsr
put 'mypassword1234' into myPass
revOpenDatabase("mysql", "www.mywebsite.on-rev.com", "myDatabase", myUsr, myPass) it should work?
Regards.
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: MySql database for app iOS and Android
Hi aebki,
Yes, just set up the phpadmin and change the remote Mysql to your ip address or one of the wildcards (! or * I think).
I didn't have to do any php coding.
This works for on-rev only because they allow it, other hosts may not.
Oh, and I think internet security people frown on using this method but others will have to tell you about that.
Simon
Yes, just set up the phpadmin and change the remote Mysql to your ip address or one of the wildcards (! or * I think).
I didn't have to do any php coding.
This works for on-rev only because they allow it, other hosts may not.
Oh, and I think internet security people frown on using this method but others will have to tell you about that.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: MySql database for app iOS and Android
Hi Simon,
Thanks for your answer...I could do it!
In fact in place of '*' it should be with '%'...
Then i tested the connection and i have one connection, as the answer of my tDatabaseID was 'something' ( in my case i had 'connection1' i think).
But after i tried this
But i have no answer...So, what am i doing wrong in my sql?
I created one table named "Members" with some columns. The first one (the primary key) is "Name".
And then i filled info...So, in "Name" i should find "aebki"...But i am not arriving here... I think i have one problem in my "SELECT"...
Regards.
Thanks for your answer...I could do it!
In fact in place of '*' it should be with '%'...
Then i tested the connection and i have one connection, as the answer of my tDatabaseID was 'something' ( in my case i had 'connection1' i think).
But after i tried this
Code: Select all
put revDataFromQuery(tab,return,tDatabaseID,"SELECT Name FROM Members ") into theResult
answer theResult
I created one table named "Members" with some columns. The first one (the primary key) is "Name".
And then i filled info...So, in "Name" i should find "aebki"...But i am not arriving here... I think i have one problem in my "SELECT"...
Regards.
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: MySql database for app iOS and Android
Hi aebki,
Check out this lesson
http://lessons.runrev.com/m/4071/l/1659 ... grid-array
For a mysql connection you have to convert database cursor into an array.
tDatabaseID should just be a number.
Simon
Check out this lesson
http://lessons.runrev.com/m/4071/l/1659 ... grid-array
For a mysql connection you have to convert database cursor into an array.
tDatabaseID should just be a number.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: MySql database for app iOS and Android
Name is a reserved word, I believe. Enclosing it in backticks might be the answer.
Re: MySql database for app iOS and Android
Hi,
Thanks to both!
So i changed "Name" for one "MyName".
And yes Simon, you are right what i have is one number in my connection...First i told you connection 1, because in fact what i told you is what i had in my answer ( answer "connection" & tDatabaseID ).
And i looked at the lesson you told me...And i think this i will need when i will use one dataGrid.
Now i am only trying to see if it is working the 'interaction with the database'...So how should i make one "SELECT count(*) from Members WHERE MyName='aebki' "???
Regards.
Thanks to both!
So i changed "Name" for one "MyName".
And yes Simon, you are right what i have is one number in my connection...First i told you connection 1, because in fact what i told you is what i had in my answer ( answer "connection" & tDatabaseID ).
And i looked at the lesson you told me...And i think this i will need when i will use one dataGrid.
Now i am only trying to see if it is working the 'interaction with the database'...So how should i make one "SELECT count(*) from Members WHERE MyName='aebki' "???
Regards.