connect react native app with sqlserver - sql-server

I already built a CMS website using ASP.NET MVC with SQLserver 2014,
and now i want to develop it into a mobile app using React Native, that I've been learning and playing with it's components for months now, but I don't know how connect the app with SQL server database. Is there anyway or solutions for connect React Native with SQL server database?

It is possible to connect a react native app with a remote MSSQL database using the react-native-mssql plugin (Android only at the moment).
Although it is best practice for security and performance to create an API interface there is nothing stopping you from connecting directly to the database if this suites your scope better than the API

You will have to create some sort of interface/API. The REST approach might be the correct one for your use case (manipulating data in a database).
Directly connecting to a SQL database from a mobile device is not recommended as the internet/network connection of a mobile device is prone to error and latency.

I would highly recommend you to make an API. The following points should explain you why:
Security (create an API with tokens or auth)
Error handling (your API should detect errors and send the correct headers)
Reusability (what if you want to connect another app or website to the database?)
Performance & API Management (you can control accesses and make statistics)
Once your API is finished, you can use it everywhere (fetch, axios, ...).

Related

Connecting react native to redis db

I'm trying to make a React Native application that needs to exchange data with a remote Redis server.
I've read on the web that I need to expose the redis API but I can't find anything about this.
The problem is that i keep getting results for react.js that is web and it's not what i'm searchng for.
Can someone write out a solution that i can adopt?

Do I need other libraries than React.js to work with databases

I just started learning react. Now I want to build a small application where:
A user can Register/Log In (working with database)
The user can add items to a todo list
The todo list is stored in a database
Do I need other libraries to work with databases?
It's a small application.
Should I use Redux or rather something using MVC pattern like ASP.net?
I don't have any expierence with any of these. After lot of research I am still clueless on where to start with.
As you are a beginner. I would recommend you to use below libraries in both front-end and backend to start with your application
Front-end:
React - works as view layer
axios - to talk to backend database for all CRUD operations
Use localstorage or session storage to work between components. Because your application is very small so you can go with this approach or consider
using redux from now if you feel your application will grow bigger in
future
Back-end:
Keep your back end service as micro-services
As you are already working on react means you know something about javascript so I recommend you write your backend service in nodejs
If you want to use No SQL database then you can go with mongoDB database using mongoose in nodejs
If you prefer SQL database then I would recommend you to start with Postgres SQL database. Postgres SQL is popular these days than
any other SQL database
These are the required libraries for you to start.
I would recommend you to go for MERN stack i.e., MongoDB, Express JS, ReactJS and NodeJS

Steps to connect Angular4 to a Database (Oracle)

Actually I've to connect my Angular project to a database to access some data. But I don't know how.
Should I write a REST API to do it? If yes, how can I connect my REST API to my project?
Which steps should I follow?
Thanks
The angular application will be your "front" application. To store and fetch data
from a database you'll need a "back" application that will provide URLS for your angular App to call.
A simple back can be done using Laravel and OCI 8 connector in order to query ORACLE database. The backend would be in PHP which is a common solution but might not fit your needs.
Set up your laravel project : https://laravel.com/docs/5.4
Install OCI8 module to connect to your oracle database : https://github.com/yajra/laravel-oci8
Then follow laravel's guidelines to set up URLs that will be callable by your front application in Angular4.

Connecting remote database in Xamarin Forms for IOS application

I have a project has two parts.
1- Windows form or WPF application that basically connects to database and write/read/update some basic text data (this part is already done).
2- On the other hand, I am currently developing an IOS app that can connect to remote database and read/write/update data.
What is the best way to connect the same SQLite or SQL database from both Windows forms app and IOS app.
Thanks in advance
The best way is creating an API/WebService which will be the interface between the database and your clients: WPF, iOS App and any other client you might want to add in the future.
Using a WebService is more secure, I guess you wouldn't want your database username and password being everywhere.
Using a WebService allows you abstract the data layer. Not using an API and using the connection to the database directly from your Apps will tightly couple your apps with the structure of your tables and any single change that happens in the database will force you to do the changes in the apps.
With WebService you decide what information will be available to the ones consuming it.
There are many others Plus on using WebServices but hope this are enough to clear your doubt.

Does React.js require server side?

All React.js introductions seem to suggest that React uses a server to create virtual DOMs and sends diff operations over to client, but I just tried out the flux-todomvc which it didn't need a server at all. What's going on? Is the "server side" work done inside web worker thread?
React.js does not use a web server to create virtual DOMs. It builds the virtual DOM and does its diff operations on the client's browser.
People mostly use React.js to implement front-end Views (MVC View) of their web applications.
But you can use Node.js to render them on the server side if you like (for seo purposes etc.)
http://facebook.github.io/react/

Resources