Can't connect to MySQL server

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
TVogelaar
Posts: 2
Joined: Tue Nov 19, 2019 11:29 am

Can't connect to MySQL server

Post by TVogelaar » Tue Nov 19, 2019 12:30 pm

I'm setting up a Wordpress site and I've been asked to provide a more efficient way to input data. So I thought about connecting to the database using LiveCode.

I tried to use the following script, which I copied/pasted from the example stack I found on Livecode's Lessons site, only modifying the connection parameters based upon the data I found in the wp-config file. However, it is not working. After a long pause, I got "Can't connect to MySQL server on '(domain)' (60)".

The database is a MariaDB. I used "MySQL" as the first parameter in the revOpenDatabase call; that is correct, right? Because I couldn't find a specific one for MariaDB.

What else could be the culprit? Is the script expecting an HTTP connection instead of HTTPS?

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

Re: Can't connect to MySQL server

Post by FourthWorld » Tue Nov 19, 2019 4:44 pm

Are you using WordPress' API or are you attempting to connect to the DB directly from the open Internet?

If the latter, it may be that your MariaDB install needs to be modified to allow remote connections. Those features are turned off by default for security reasons, but it's possible (though not recommended) to turn them on:

https://mariadb.com/kb/en/library/confi ... nt-access/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

TVogelaar
Posts: 2
Joined: Tue Nov 19, 2019 11:29 am

Re: Can't connect to MySQL server

Post by TVogelaar » Tue Nov 19, 2019 6:33 pm

That helped me on the right track. The helpdesk at the ISP informed me that it can't be opened for remote client access. But I can create a database connection file in PHP.

Should I just "POST" the data as I would do with form processing? Or are there other ways to do a SQL insert using Livecode with PHP as an intermediary?

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

Re: Can't connect to MySQL server

Post by FourthWorld » Tue Nov 19, 2019 7:26 pm

TVogelaar wrote:
Tue Nov 19, 2019 6:33 pm
Should I just "POST" the data as I would do with form processing? Or are there other ways to do a SQL insert using Livecode with PHP as an intermediary?
People like to do all sorts of things; the most fashionable option is to use RESTful style, taking advantage of the big four methods: GET, POST, UPDATE, DELETE.

Having looked at the fashion arguments in depth for several years, while I can see the benefits I also see that unless you can reduce EVERYTHING your app needs to do down to basic CRUD operations, sooner or later you'll have to break from good REST style.

So I've joined the growing backlash against REST, using POST for just about everything, with a param containing a command name that directs the server to perform a specific action. Sure, kids fresh out of school will balk, but not everything lends itself well to RESTfulness, so sooner or later as an API grows you'll need something beyond the big four methods anyway. I just accept that up front and use a command param for everything.

In short, yes, POST is simple and versatile.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Databases”