user784637
user784637

Reputation: 16142

How to establish a connection from a wxpython desktop app to a remote msyql database?

I'm writing a desktop app in wxpython. For simplicity sake let's say it's a just a frame with a button in it. When someone clicks that button a record inserted into a remote mysql table with the public ip from which the click was made from.

CREATE TABLE clicks(
click_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
ip_address VARCHAR(128),
exec_datetime DATETIME,
PRIMARY KEY(click_id)
)

What is the best method to establish a connection to a remote mysql database and insert a record from this desktop application?

Upvotes: 0

Views: 385

Answers (1)

dm03514
dm03514

Reputation: 55962

One way is to wrap your mysql calls in a web service (API). The clients would then make web requests to your webservice through http/s

creating a web service would allow you to control authorization/authentication of your clients. (the wxpython app)

This can also be good because almost always port 80/443 (http/https) are open. If you connect directly to your mysql database using python, there could be possiblity that port is not open. Also, by using a webservice you can better throttle/control requests to your database, It gives you an additional place to cache frequently used data, that a direct connection might not facilitate.

Upvotes: 1

Related Questions