Connecting visual c++ to an online database - mysql

I am working on an app in visual c++ which requires data to be accessed from a database which can be edited so that every time there is a modification to the data I do not have to resend the app as it will automatically update, it is also required that this is a desktop app.
I am currently using MySql however for this to run constantly I will be needing a server which for a single simple app wont really be worth purchasing, so I started thinking of alternative methods and thought to myself there must be some method of reading directly from a website or online database, am I correct in thinking this? If so could someone please explain how I would achieve this?
Also, I have purchased phpmyadmin in the past so if there is any way I could connect my visual c++ app to a database from this then that would be great.
EDIT: Note, this app relies almost entirely on the database as it is just 3 combo box's and one text field all of that values for which come from the database.

The following response is assuming that by online you mean on the web.
You cannot exactly 'connect' to an online database with C++ (or anything outside of that server hosting the database).
What I would do is create some PHP API's that you can POST to with libcurl via C++. You can both send and receive data this way.

Related

Windows phone 8.1: Need suggestion on what database should I use

For my Windows phone project (it's a Universal app), I have a set up that has a country and a phone number in one of the page. There are about 7 other pages that requests the user for additional information. But for starters, let's just stick with the first one, that asks for the country and the phone number.
I read through a million posts in Stackoverflow and other websites alike, to know what database system is best to implement with the sort of app I am going to be developing, or hoping to develop.
Here're my findings:
Azure SQL: I have an Azure account and I can use the Azure SQL service to store the user-input data directly to the database (when the app goes live), or while in the testing phase. But I got to know that feature isn't really working well as windows phone cannot readily update the data to Azure SQL, on realtime basis. Is it so?
MySQL: I thought I'd create a local MySQL database, for testing purposes, so as I input the data (in the emulator perhaps), the database saves it. I am unsure how I can implement this. I can't find any article I can read that can help me with this. There are with ASP.net, but it isn't what I am going to be using.
SQLite: I know for a fact the data can be stored locally, by using SQLite, but I could like to know if the locally stored data can be later updated on a server-side machine (i'd prefer Azure SQL, but MySQL is also OK with me). If it can be, i wouldn't mind settling with it. If it can't, what can I do?
It all boils down to this: What's the easiest way to store data entered in a textbox (lol, yeah!) to a database (locally or server-side)?
Your efforts to help me will be greatly appreciated!
Thanks!
You can stay on Azure SQL if you have an account.
It works fine and it updates database on the go (sends json as far as I remember), so you shouldn't worry about data being stored in a cloud. Moreover, it is super-easy to use it for your needs (store data from textbox).
Azure SQL will get your bootstrap the fastest for your application. There is no need to deploy MySQL or SQLite and managing your DB. There should not be any concern about updating the DB live from the app.

iOS and Mac OSX communicating with MySQL database

I have a client who wants a control panel for the app I am developing them. The control panel is a Mac OSX application that allows the user to submit files (excel docs and such) to my MySQL database. Those files are then checked by the iOS app I have created for them.
I have no idea how to do this. I have the MySQL database all set up, and I have looked everywhere for a solution. Any help is appreciated.
I wouldn't try to connect to your MySQL database directly from your cell phone. It's a bad design for several reasons. Instead build a API on the same server as the MySQL database. It doesn't matter if you do it in java, php, c# or anything else. You might even find some product or open source project that can do this automatically. I've listed some benefits of doing it this way
It makes testing easier. You can write a test framework against your API that doesn't rely on or is using a phone.
It makes development faster. You don't need to emulate or use a phone to develop and test your table design and queries.
It gives you compatibility. When you need to change your database (and you do) you can create new APIs that the new version of the app uses while and old version still out there can continue to use the old API (that you might have to modify to still provide the same functionallity)
It gives you flexibility. If your user base grows and you might need to have replication for reads or sharded databases you build that into the API instead of into the app which is just a better way to do it.
One option would be to use PHP to handle all the database interaction.
Host the scripts on the server and just have the apps call them and get the scripts to return some sort of parseable response (I'd go for JSON).
I have never found a suitable Object-C based connector for MySQL. At this point I would suggest using a C/C++ connector. There's lots of examples of how to configure the connector for both C and C++. The hard part will be all of the data passed from the MySQL code and the Object-C code will that it will have to be in C types.
EDIT: An Example

iOS and SQL xml report

I know that there's a lot of posts about that, but i can't find any one that suit my needs.
Here we go: I am developing (newbie dev, of course) an iOS app that is suppose to populate an UITableView with the acquired data from a xml report from a server (mysql and php).
The point is I was able to manually generate the sql report on the server (actually is a wordpress plugin that manually generate and save the report inside a folder on the server) and made the app download it by pointing to the right location of the file (very basic i Know) but is there an easy way of making my app send a request to the server to automatically generate and download the xml?
All the data i must use is inside a database on the server. The parse of the xml is not that difficult and I can handle it. My real problem is allowing the app sending those requests to the server.
Please note that i have no experience in PHP or SQL and have poor knowledgement on that tools so that is what i haven't found any post that suits me as all of them talks in a advanced SQL and PHP language.
All help is appreciated.
Thanks in advance folks!
You'll want to make an NSUrlRequest against a php script on your web server that runs the query and returns the XML as the output. See this link from the Apple guide to get you started: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html
The question is too general to give more specific advice than that you should take a look at the Cocoa URL loading system, or alternatively another networking library such AFNetworking.

Desktop programming language to connect to remote MySQL

A customer of mine asked me a better and faster solution to update it's real estate web site as he and his employees don't want to connect to the web site and update one by one the ads as they don't want to loose time waiting the normal latency of the internet.
I firstly solved the issue by building a PHP script that imported an Excel file into the web site's MySQL database and it worked greatly. But the problem were pictures that have still to be uploaded separately. I then wrote a PHP script that uploaded the pictures using ajax and drag&drop so the user could select multiple pictures and upload them at once. And this worked too, but the customer is still not completely satisfied as he says this solution is quite 'patched'.
I then thought about a desktop application - a kind of local database (could be SQLite) - that the user keeps updated locally and only at the end of the day the app connects to the remote server and updates the db and uploads the pictures.
My question is: what EASY desktop high level programming language I could use to do the job? Do you know any RAD (visual IDE) programming language able to connect to a remote mySQL server and upload data via a simple custom GUI?
I tried RealBasic and PureBasic but I did not work it out. I thought about building the app in PHP and then convert it to EXE but I did not tried yet.
Please don't suggest me Java, C or Delphy as I'm looking for something very easy.
Thank you
Have you considered a client side javascript/html app that syncs with the server, since you're already familiar with the platform? If one browser better supports what you want to do (Firefox has some extension perhaps vs Chrome, or whatever), than mandate that to run this app (rather than worrying about being portable across browsers).
All of the browsers can have client side storage now, and you can just do things locally, and finally push them to the server "all at once".
If your client is using a Windows platform, you could use IronPython (.NET), VB.NET, or C#. These all allow you to create windows/forms visually in Visual Studio. If you're not already familiar with the .NET platform I'm not sure how 'easy' this will be, but I think that's going to be true for most other platforms as well.
That being said, it sounds like your existing solution is probably the best idea - perhaps if you can make your solution feel less like a "patch" they will be satisfied.
No reason you can't use Purebasic if that's what you're comfortable with. There are HTTP file upload examples on the PB forums.
I've used Purebasic for years but I'd recommend spending the time to get to know C#/.NET - it's a world of difference and once you learn it stuff like this is pretty easy.

How to have Android App communicate with external MySQL db

I am really confused on how to get data in and out of an android app from the internet.
I imagined that I would store information in the mysql db on the server I already have set up. But from what I have read, I would need some type of in-between web service to make queries with data sent from the app.
Can anybody toss me some tips on how to get something like this started.
Or, if you know of a better way, let me know about it.
This question has been asked several times, for example here: How to get from a MySql server to an Android app?.
Bottom line - you don't connect directly. You have something on your server (like RESTful) that you connect with via HTTP.
Try this method out. I will be using this method for the current project i am working on.
You basically create a php script on a server and use http posts to send the data to the script, read the tutorial linked below for better explanation.
mysql/android tutorial