Page 1 of 1

online mysql

Posted: Fri Jan 22, 2016 7:28 pm
by Da_Elf
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

Re: online mysql

Posted: Sat Jan 23, 2016 2:38 am
by Simon
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

Re: online mysql

Posted: Sun Jan 24, 2016 2:36 am
by Da_Elf
opps.... is it safe though?

Re: online mysql

Posted: Sun Jan 24, 2016 2:40 am
by Simon
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

Re: online mysql

Posted: Sun Jan 24, 2016 12:40 pm
by Da_Elf
well thats not good.

Re: online mysql

Posted: Sun Jan 24, 2016 4:34 pm
by ClipArtGuy
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.