connecting to mySQL
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
connecting to mySQL
on mouseUp
global gConnectionID
put "xxxxx" into tDatabaseAddress
put "xxxxxx" into tDatabaseName
put "xxxxx" into tDatabaseUser
put "xxxxx " into tDatabasePassword
-- connect to the database
put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
if tResult is a number then
put tResult into gConnectionID
answer info "Connected to the database." & cr & "Connection ID = " & gConnectionID
else
put empty into gConnectionID
answer error "Unable to connect to the database:" & cr & tResult
end if
end mouseUp
Hi all,
I am making a public app which would connect to a MySQL database on Godaddy server.
Is there a better way to connect to it rather than the example above been thought by RunRev?
If there is, kindly help in an easy to understand term, as I am pretty new to Livecode.
Regards
Malin
global gConnectionID
put "xxxxx" into tDatabaseAddress
put "xxxxxx" into tDatabaseName
put "xxxxx" into tDatabaseUser
put "xxxxx " into tDatabasePassword
-- connect to the database
put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
if tResult is a number then
put tResult into gConnectionID
answer info "Connected to the database." & cr & "Connection ID = " & gConnectionID
else
put empty into gConnectionID
answer error "Unable to connect to the database:" & cr & tResult
end if
end mouseUp
Hi all,
I am making a public app which would connect to a MySQL database on Godaddy server.
Is there a better way to connect to it rather than the example above been thought by RunRev?
If there is, kindly help in an easy to understand term, as I am pretty new to Livecode.
Regards
Malin
Re: connecting to mySQL
Hi Malin,
1. welcome to the forum!
2. This is the correct forum for database question, be they local or online.
Therefore I deleted the double posting in "Internet".
3. I do not know of any OTHER way to connect to a database than "revopendatabase ..."
Question is, does GoDaddy allow direct connection to the db?
For security reasons most providers demand a "middleware" like PHP or Livecode-Server,
which does the actual db access stuff.
Best
Klaus
1. welcome to the forum!
![Very Happy :D](./images/smilies/icon_biggrin.gif)
2. This is the correct forum for database question, be they local or online.
Therefore I deleted the double posting in "Internet".
3. I do not know of any OTHER way to connect to a database than "revopendatabase ..."
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Question is, does GoDaddy allow direct connection to the db?
For security reasons most providers demand a "middleware" like PHP or Livecode-Server,
which does the actual db access stuff.
Best
Klaus
Re: connecting to mySQL
Hi Klaus,
Thank you for your reply.
My main concern is that it is not possible/advisable to connect to database on godaddy directly like tought on the lessons sold by livecode.
But the lessons have been so helpful and educative that i can easily query test tables.
My question:
1. if i use webservice, does i just use it inplace of the connection of the normal connection parameters to database and other query language in the script will remain the same or do i need to rewrite the whole script?
2. if i need to rewrite the whole code, is there a lesson or resource that really teaches about using webservices and quering table.
3. is livecode hosting package as good as other commercial webhost (eg godaddy)
Thank you for your reply.
My main concern is that it is not possible/advisable to connect to database on godaddy directly like tought on the lessons sold by livecode.
But the lessons have been so helpful and educative that i can easily query test tables.
My question:
1. if i use webservice, does i just use it inplace of the connection of the normal connection parameters to database and other query language in the script will remain the same or do i need to rewrite the whole script?
2. if i need to rewrite the whole code, is there a lesson or resource that really teaches about using webservices and quering table.
3. is livecode hosting package as good as other commercial webhost (eg godaddy)
Re: connecting to mySQL
Hi Malin,
If you can use Livecode Server, then the syntax is identical.
No idea about PHP etc., but that will sure make a complete rewrite neccessary!
Check sites like these to learn about using PHP: http://www.w3schools.com/php/default.asp
Best
Klaus
well, that depends on the webservice you are going to use!malin wrote:1. if i use webservice, does i just use it inplace of the connection of the normal connection parameters to database and other query language in the script will remain the same or do i need to rewrite the whole script?
If you can use Livecode Server, then the syntax is identical.
No idea about PHP etc., but that will sure make a complete rewrite neccessary!
Check sites like these to learn about using PHP: http://www.w3schools.com/php/default.asp
For some LC server examples, check this website: http://on-rev.com/revolution/overview/malin wrote:2. if i need to rewrite the whole code, is there a lesson or resource that really teaches about using webservices and quering table.
I have no idea!malin wrote:3. is livecode hosting package as good as other commercial webhost (eg godaddy)
![Cool 8)](./images/smilies/icon_cool.gif)
Best
Klaus
Re: connecting to mySQL
Thanks for your reply.
I am reading the lesson you sent me![Smile :)](./images/smilies/icon_smile.gif)
One last question, as I apologize if am kind of an headache
If I use livecode server with the normal DB connection lesson from livecode, is there a way to safe guard my user info... Username, password, host address... Since my fear is that they will be packaged with the app. Or ounces the app is packaged onto andriod and iPhone this information becomes encrypted?
Tack
Malin
I am reading the lesson you sent me
![Smile :)](./images/smilies/icon_smile.gif)
One last question, as I apologize if am kind of an headache
![Mr. Green :mrgreen:](./images/smilies/icon_mrgreen.gif)
If I use livecode server with the normal DB connection lesson from livecode, is there a way to safe guard my user info... Username, password, host address... Since my fear is that they will be packaged with the app. Or ounces the app is packaged onto andriod and iPhone this information becomes encrypted?
Tack
Malin
Re: connecting to mySQL
Hi Malin,
the webservice does the db conncetion, so no username and password etc. in your app at all!
Are you sure you understand the principle of using a webservice?
Best
Klaus
the webservice does the db conncetion, so no username and password etc. in your app at all!
Are you sure you understand the principle of using a webservice?
Best
Klaus
Re: connecting to mySQL
Hello again
Well am trying to understand it, but the lesson livecode has on it is not enough to dabble into it.
I am going thru lessons on udemy to see if I can find something suitable, but it's tough since even if I know it, there seems to be no lessons regarding implementing it with on livecode.
Have you any advice?
Thanks
Well am trying to understand it, but the lesson livecode has on it is not enough to dabble into it.
I am going thru lessons on udemy to see if I can find something suitable, but it's tough since even if I know it, there seems to be no lessons regarding implementing it with on livecode.
Have you any advice?
Thanks
Re: connecting to mySQL
Hi Malin,
but the webpage/webservice gets the database content and displays it in your browser nevertheless!
Best
Klaus
see the database example of Livecode server, you do not provide anything like pwd or username,malin wrote:Well am trying to understand it, but the lesson livecode has on it is not enough to dabble into it.
but the webpage/webservice gets the database content and displays it in your browser nevertheless!
No, sorry, not my "cup of tea", really...malin wrote:Have you any advice?
Best
Klaus
-
- Livecode Opensource Backer
- Posts: 447
- Joined: Mon Jan 23, 2012 12:46 pm
Re: connecting to mySQL
Hi Malin,
Welcome to the forums. I am not an expert in webservices or databases, but I recently set up a server script to handle fetching high score information for my app, so as not to store my credentials inside the app. The first thing you will need is LiveCode server installed on your server. I followed the instructions here:
http://activethought.net/setting-livecode-server/
I then simply moved the part of my app script that fetched high score information from the database to a LC server script. Then in my app script instead of connecting to the database directly, I used GET to connect to my script on the server, at which point I can parse the info, etc. It's a bit early and I haven't had my coffee yet, but I think this is what you are after....
--Sefro
Welcome to the forums. I am not an expert in webservices or databases, but I recently set up a server script to handle fetching high score information for my app, so as not to store my credentials inside the app. The first thing you will need is LiveCode server installed on your server. I followed the instructions here:
http://activethought.net/setting-livecode-server/
I then simply moved the part of my app script that fetched high score information from the database to a LC server script. Then in my app script instead of connecting to the database directly, I used GET to connect to my script on the server, at which point I can parse the info, etc. It's a bit early and I haven't had my coffee yet, but I think this is what you are after....
--Sefro
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: connecting to mySQL
How about this lesson;
http://lessons.runrev.com/m/4071/l/1172 ... a-database
Though that is an on-rev server it is using cPanel and I believe godaddy is the same.
Simon
http://lessons.runrev.com/m/4071/l/1172 ... a-database
Though that is an on-rev server it is using cPanel and I believe godaddy is the same.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: connecting to mySQL
@ Sefro and Simon.
Thanks a lot.
kind regards
Thanks a lot.
kind regards