Vojtěch Prchal
Vojtěch Prchal

Reputation: 161

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

Upvotes: 4

Views: 13294

Answers (3)

sam nikzad
sam nikzad

Reputation: 1360

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.

Upvotes: 8

Milind Mevada
Milind Mevada

Reputation: 3285

If you want SQLite DB only for React Native Use this

Second thing

Realm is not SQLite DB. It's Built from the ground up.

So, If it's fine to have the different database then SQLite. You can start with Realm here

Upvotes: 1

Rodrigo.C
Rodrigo.C

Reputation: 1173

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.

Upvotes: 2

Related Questions