Connecting MySQL database to Mac app - mysql

The question is pretty simple, however it seems like there's a million variations on the answer, therefore although this question has definitely been asked before, I'd like to ask it again in the hope that an up-to-date answer can be sought.
Basically I'm creating a Mac app and part of it will be powered by data that I have in a remote MySQL database as part of my site. My question is this: what is the best way of connecting to that database so that the data can be used in my app?
I have read many answers that suggest using a web service to convert the database to JSON or equivalent and then converting that into objects that can be used via Core Data is the best way, however the data that I want is 'dumb', i.e. I won't be changing or manipulating it in anyway, therefore I think Core Data is potentially overkill for what I need.
Are there any other more straightforward ways of achieving this task?

Related

How can I connect my react native app to MySQL server?

I'm creating a mobile app for an existing website and trying to connect to a local instance I have running on a MySQL workbench. I've seen others recommend against the use of MySQL but I'm stuck with it, since that's the current database. I'm using expo to run my React Native code. Do I need to use a server, like "MAMP?"
Let me know if there is any more info that is needed.
You cannot connect your app directly to your database.
You will need a server/API that acts as an intermediate between the app and the DB. You can code it in most programming languages and if you know PHP, having MAMP on your system will allow you to build your API with PHP.
I've seen others recommend against the use of mySQL
You should definitely question their reasoning. I've been using MySQL for many years now in small and big projects and it has never been an issue. If they're comparing it to non-relational DBs like Mongo, I can understand, it's easier to setup and maintain a NoSQL database than a relational one.
I assume you're not that experienced but I still purposefully used some terms that may be new to a beginner. Since I don't know your skills, I will refrain from pointing you to specific tutorials/articles.
I recommend you to Google anything you don't understand from this answer.

Reading from a databse in AngularJS

My question is a simple enough one but I can't quite seem to find a good tutorial on it. Maybe I am not being specific enough with what I am asking but I can't really type an explanation into google and expect an answer.
So here is my question;
I currently have a website up and running on a hosting site and this hosting site allows me to have a database up on their server as well.
So my question is how do I read data from this database that I have setup using phpAdmin? Also, it is a mySQL database.
The website will be acting like a review site built I just want to use it to learn web development as well. So What I am trying to do it read articles that I will be saving in the database so I can display them on my website.
Any help or advice in regard to this is much appreciated.
Thanks in advance,
Cylon.
you cant read directly from a Database using AngularJS or any Client-side framework , you need a back-end / server-side language such as PHP ,C# ,Java..
to connect to your MySql ,MSSql... ,
so in your case your need to create PHP script which will connect to the Database and provide an interface you can access with (GET , POST methods ) using AngularJS ($http.post("url"...)
for a best practice (if you want) the Data should be in JSON format.

Is it possible to write mysql queries in Angular.JS?

Im new to Angular.JS and just wondering if it is possible to write mysql queries in angularjs?
I would like this as I am trying to create a messaging system in which I query the database and get the information live to the webpage.
Any help is appreciated, hope the question is reasonable. Gab
That is not advisable (if possible at all) as it would defeat the purpose of Angular.
You should consume data by targeting a RESTful api/service exposed by the server. The service would handle the DB access for you and provide the data to Angular using a more portable format (e.g. JSON or XML)
Some of the basics of linking Angular and REST are described here
There are related questions on SO about exposing your particular DB flavor using REST here.
This can only be a starting point but it should give you some ideas. I will try to amend this with more info as I come across it.

MySQL and Core Data in iOS

I want to retrieve data from remote MySQL database and store the data in my iOS app (creating "local" database, so the information can still be accessed even though there is no connection). After doing some research, Apple's Core Data API seems to be the answer. However, it's using SQLite.
Can I use Core data with MySQL? If the answer is no, is there any way to develop "local" database other than Core Data? I tried looking for the answer, but no luck. This is the closest one that I can get, but I don't really understand the answer. I am new at iOS development, so any help is greatly appreciated.
Yes, you can use Core Data with MySQL if you like, but you need to write the persistent store functionality yourself, which is a fairly advanced undertaking. It doesn't seem to have any benefits though. I think it would be better to retrieve the data from the MySQL server, and then store it locally in Sqlite. MySQL requires a separate server so obviously it cannot be run locally on iOS anyway.
You cant use coredata with MySQL. Because CoreData is a local database inside the mobile and MySQL is WebServer database. So we cant combine them. Why you dont like CoreData? It is the most powerful and simple database for the mobile apps. I think CoreData suits for your purpose. If your data is something lightweight. Then you can use
Plist
http://hayageek.com/plist-tutorial/
http://www.theappcodeblog.com/2011/05/30/property-list-tutorial-using-plist-to-store-user-data/
NSCoder
http://www.raywenderlich.com/1914/nscoding-tutorial-for-ios-how-to-save-your-app-data
CoreData is the way to go. CoreData is build under SQLLite but it is a relational data base --> Object Oriented mapping which makes it really convenient.
There's a graphic editor which will allow you to define your CoreData model the way you require it.

MySQL wrapper for ios

I am working on my first iOS-application and I want to use MySQL as my remote database.
I've been googing around and reading here at Stack, but I can't find my new answers to the question. Does there exists any good wrappers out there? I found this link: mysql for ios, but it clearly states that it is not guaranteed to be accepted in the App Store.
I really want to have a wrapper rather than using some sort of webservice.
Anyone have some more updated news on this?
Your best bet is to use SQLite or CoreData libraries, they are very low overhead. CoreData is built into iOS functionality, SQLite just needs the .db file and a library (part of iOS) imported.
If you could somehow get your MySQL database online and expose it via REST you could possibly use REST to get and set data into and out of the database. But this will slow your app to a crawl.
CoreData is fast, and when using the data in context like that, it simplifies everything. Writing SQL statements is slowly becoming an archaic process.