Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect MS SQL database using React-Native ?

I am building a react native app for mobile on my MacBook. I want to connect MS SQL server where is installed in VMware Fusion virtual machine. How can ı connect my MS SQL server on my MacBook?

like image 609
Kaan Karamanoğlu Avatar asked Nov 16 '18 14:11

Kaan Karamanoğlu


People also ask

How do I connect to a mssql database in react?

Click Add Connection. Configure the connection in the resulting dialog: Name your connection, select Microsoft SQL Server as the database, fill the Server field with the address of the server, fill the Database field with the name of the SQL Server database, and fill in the User and Password fields.

Can we use SQL database in react native?

React Native is also compatible with server-side databases. The list includes SQL databases, such as: MySQL.

How does react native connect to database?

To install the "app" module, view the Getting Started documentation. # Install & setup the app module yarn add @react-native-firebase/app # Install the database module yarn add @react-native-firebase/database # If you're developing your app using iOS, run this command cd ios/ && pod install && cd ..

Can I use SQL with react?

Yes. We are building an end-to-end project with React + Express + Node. js + MySQL. MySQL is an open-source relational database management system (RDBMS).


1 Answers

You can't. Or more appropriately, you shouldn't. React is a front end library and it should connect to a backend service such as REST API which then connects to MS SQL database.

The reason why you shouldn't is simple. Front-end libraries have all their code running in the client's browser which allows the user to view the source. If the user can view the source and there is a database connection in the source, he'll be able to connect directly to your database.

By using a REST API, you can hide all database connection information on your server to which the user has no access.

Sample tutorial: https://dzone.com/articles/aspnet-core-crud-with-reactjs-and-entity-framework

like image 81
bobek Avatar answered Oct 25 '22 15:10

bobek