0

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?

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

7 Comments

I have read about OAuth 2 authentication, do you think it is necessary to set it up as well for security purposes or a simple REST API is enough for most apps?
This is depending on your application. Simple basic authentication via TLS might be an option too. Implementing OAuth from the start is a good idea if you intend to share some of your applications data with third party API clients. What does your app do?
I am using an SQL Server database for user authentication (for log-in/sign-up) purposes and need database connectivity for that.
What kind of data/content is protected by that account? There has to be something that is restricted by this authentication.
For now it is just some core app features like user's personal health data management, sort of like an activity tracker and record keeper. There is no integration with third party sources, all data that is used in app is stored on my own servers/database.
|
0

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, ...).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.