简体   繁体   中英

How can C++ applications access a remote MySQL database without making MySQL server accept remote connections?

I'm looking for an effective approach for this problem:

Server:

  • Webinterface, User can use forms.
  • The Data entered in the forms is getting saved in a database.

Several clients:

  • A client program written in c++ can access database.

When I use a normal MySQL DB I would have to open the whole MySQLServer to accept remote connections, which I would like to avoid.

I found several MySQL APIs, but no alternative for my problem. An 'webdatabase <-> remote c++ client' solution.

Will I have to write my own server which will parse the DB info to the client? :/

Hope there is an easier solution!

What you will want to do is write an API that runs on the same webinterface to which you can programatically talk. You can look at SOAP for example, or a REST based service, or simply JSON.

This will allow your C++ client to "connect" to the database on the server side through a controlled channel so that you are not opening up MySQL to access from the outside.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM