online mysql

Creating desktop or client-server database solutions?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

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

online mysql

Post by Da_Elf » Fri Jan 22, 2016 7:28 pm

What am i missing here. Im hosting with hostmonster and ive got my database setup with username and a demo table created. Im getting a "cannot connect to server on that address" error. When im working on a local mySQL database i just use localhost:3306 or the ip address of the computer on the local network + 3306
Would like to know what im doing wrong. I can get the demo software to work from http://lessons.livecode.com/m/4071/l/70 ... l-database which uses im assuming an online server database at runrev.com......

minor EDIT... found on hostmonsters site
"When connecting to your database the hostname you will almost always use is localhost. The exception to this will be if the script or program you wish to connect to the database is running on a different system than the one hosted with Hostmonster, in which case the hostname will be host271.hostmonster.com"

So i changed tDatabaseAddress to host271.hostmonster.com from what i had before. Still no luck though

Code: Select all

local gConnectionID

on mouseUp
   dbaseConnect
   put revDataFromQuery(tab, cr, gConnectionID, "SELECT * FROM users ") into trData
   dbaseDisconnect
   answer trData
end mouseUp

on dbaseConnect
   put "host271.hostmonster.com" into tDatabaseAddress
   put "dbaseNaame" into tDatabaseName
   put "dbaseUser" into tDatabaseUser
   put "dbasePassword" into tDatabasePassword
   put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
   if tResult is a number then
      put tResult into gConnectionID
   else
      put empty into gConnectionID
      answer error "Unable to connect to the database"&cr&"Please check your IP address"
   end if
end dbaseConnect

on dbaseDisconnect
   revCloseDatabase gConnectionID
end dbaseDisconnect

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: online mysql

Post by Simon » Sat Jan 23, 2016 2:38 am

Hi Da_Elf,
Just to be dull because I don't have a better answer for you.
Have you allowed access (using %) via Remote Database Access Hosts (Remote Mysql) in cPanel?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: online mysql

Post by Da_Elf » Sun Jan 24, 2016 2:36 am

opps.... is it safe though?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: online mysql

Post by Simon » Sun Jan 24, 2016 2:40 am

Hi Da_Elf,
Yeah, I've asked that question.
Seems really weird to have a security system that you have to turn off to make it usable by others.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: online mysql

Post by Da_Elf » Sun Jan 24, 2016 12:40 pm

well thats not good.

ClipArtGuy
Posts: 230
Joined: Wed Aug 19, 2015 4:29 pm

Re: online mysql

Post by ClipArtGuy » Sun Jan 24, 2016 4:34 pm

I think what you will need is to use a "middleware" script on your server. It is not safe to hard code your database credentials in the actual app. there have been several threads on this, do a search of the forum for "middleware" to get some examples.

Post Reply

Return to “Databases”