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

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.

Related

Meteor - Mysql (Integration between LAMP and Meteor.JS) cross platform

I have an existing application based in LAMP and now I am looking to develop a new module of the existing system in Meteor.JS (Only New Module, keeping the existing system as it is)
I know that Mysql is not officially supported till now in Meteor. I have gathered some knowledge that, using a package numtel:mysql, we may get support for mysql, but I feel that is also limited.
Now, my question is: I have one project built on a LAMP stack, and I wanted to develop a new module for this in Meteor using the same Mysql database, as its contains existing records. (I know that I have to do some workaround for sign-in and authentication between two, and that I have to take care too.
But I just wanted to know, Is it possible to use the existing system (Mysql database) and what are the possibilities of creating a new module in Meteor. Can someone put shed light into this scenario?
Also, can someone suggest to me how to do single sign-on between these two different applications (LAMP and Meteor)
What are the steps that I should take in order to achieve this?

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

Connecting MySQL database to Mac app

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?

creating a basic database

Right now, in my internship, I'm assigned to create a system that holds employee information such as personal info, education, salary, etc.
All these stuff is kept in a few spreadsheets right now. I need a basic program, but I feel like I should be using MySQL or another database solution to hold the data. I used MySQL before, but it was a PHP/MySQL assignment which I used Wampserver to create the whole system.
Edit: The system will be used by a few computers across the network. When someone makes a change to the system, it will become visible to other computers aswell. (obviously) (Before the edit, I thought that it's gonna be used by a single computer.)
I'm confused right now. Should I create a PHP/MySQL webpage with wampserver (or similar) to hold the information, or not?
Would it be easier or better to combine MySQL with some other programming language (such as Java/C++) and build a GUI? (I doubt it)
Should I come up with a different solution? Without database usage?
Database usage would be the best option. In the end it will come down to what you are more comfortable using, Java/C++ or php, for what you want to do either can work, but remember the database will need to be live at all times and using wamp server wont cut it. You need to learn how to tun a mysql server without wamp, which is easy(Google is awesome). And personally I would have used Java because Java is also easy to link with mysql, just google it a bit, and java doesn't need to run on a server so no wamp needed as you would have needed for php.
EDIT:
Ok if I understand you correctly what you want to do is the following:
1. Identify a pc to be used as a server and assign it a static IP.
2. This must also be the pc that is turned on first every day and turned of last.
3. Create a front end client application that connects to your sql server that you will be running on the server machine.
Now I am assuming this network is rather small, so you wont need a specific computer to just act as server. The server can also be one of the client machines.
The best approach would be to create a mysql server and make sure the firewall is not blocking your sql server. Then create a client application that can access the database over the network using Java, I find this easier than creating a php server for the users because of port forwarding for an apache server is time consuming, I did it once and never again. Java will be easiest to make the application work over the network. Use Netbeans for the development, it's an awesome IDE and it makes life easier when setting up the database connection.
If you have anymore questions please ask in comment, and I will elaborate, since this might be a bit vague lol.
Of course you should use a database for this type of work. That is the best way to organize, search, sort and filter your data without having to reinvent the wheel.
As to the other questions, the choice of language and environment is up to you to decide after evaluating the needs of your application.
Your solution should use a database to store the data and an front-end application to manage the data.
The database and front-end should be seen as two separate layers. In other words create the database using whatever database your are familiar with eg: MySQL and likewise create the front-end using whatever technology youre familiar with eg: PHP.
Personally for this type of requirement i would typically use MySQL / SQLExpress and ASP.Net / MVC3 front-end.
Hope this is helpful.

ODBC tools for MySQL

We have ROR site with a MySQL database. There are many tables which we would like read/write access to, but we have not written this function within our current admin panel. I was curious the drawbacks of using an ODBC tool to perform all reading/writing of values to the database from the admin panel. Also, does anyone have any suggestions for ODBC tools that we should look into for an easy to use software.
I think that you haven't actually started using Rails, else you wouldn't ask this question. Go spend some time reading the documentation and a few getting started tutorials.
http://guides.rubyonrails.org/
Rails comes out of the box with ActiveRecord, an ORM layer. Once you get familiar with it, reading/writing to the database will be a breeze, independent of what database you are using.