Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have a SQL database in React Native?

Can i have in my React Native application some database which know how to handle SQL orders (SELECT,INSERT...).

I was thinking about realm but that cannot handle SQL orders and i couldn't npm install SQLite library for React Native successfully.

Are there any other alternatives? How to install SQLite for React native? (error in linking package to project).

like image 910
Vojtěch Prchal Avatar asked Oct 29 '25 20:10

Vojtěch Prchal


2 Answers

If you search around web, you will find developers are using these major databases for React Native. Such as:

1. Realm
2. Firebase
3. SQLite
4. Core Data
5. PouchDB
6. Async Storage(not a full scale database, but still quite popular)

But, which Database is right for your React Native Application? To make the unbiased comparison, we are taking many development factors, and application features into consideration.

For Instance:

Offline-first

Does it supports offline feature in the app? How does it handle synchronisations and conflict across multiple devices?

Database security

Does it supports AES 256 level of encryption and decryption? Would I be able to implement a secure authentication?

App performance

To evaluate the performance, we took many factors like read/write speed, zero copy design, storage engine, and how does it handle concurrency control?

Industry regulations

Large organisations have to adhere to industry regulations and compliances in order to deploy their application securely. Learn which databases comply with regulations, and which don't.

Supported file and data types

We explored the data types(Bool, Int, Int8, Int16, Int32, Int64), and file types(images, videos), which are supported by these databases.

Pricing

Some databases are open source and free to use like SQLite, and PouchDB. But, databases like Realm, and Firebase charge for their additional features. Find out how database pricing stacks up to your needs.

Real time sync

For Streaming, and gaming applications, Real Time Sync is crucial. Learn which database is more suitable when you need to sync the data in real time.

like image 141
sam Avatar answered Nov 01 '25 11:11

sam


Probably you can use a library like this https://github.com/andpor/react-native-sqlite-storage

Using SQLite in both Android or iOS natively is pretty straightforward, anyway you need some interface in react native to handle the DB, this library would solve both issues for you.

like image 30
Rodrigo.C Avatar answered Nov 01 '25 11:11

Rodrigo.C