I would like to connect with React Native to an external database, like PostgreSQL, MySQL or what ever. Is this possible?
But first let me tell you something about my plan: I will develop my application for multiple installations (multiple devices - one installation on one device). All devices are connected with a local network which is provided by a Windows installation (server). On the server runs a database (PostgreSQL) and I would like to connect to this database with all my devices. The server (or in fact its database) should store tasks and each device should access to these tasks (read and write) locally.
I had also some other ideas like simple SMB-XML file storage (but the problem with collisions) and an SQLite database on an SMB shared file - but the website of SQLite tells that this will not avoid problems with multiple accesses. Therefore I need another local solution. This brought me to provide a database which is accessible from the local network.
I would be very grateful if someone has a note how to solve this problem.
Thank you!
In order to access a database directly from react native you would need a pure JavaScript database driver. A quick google search produced a JavaScript drivers for PostgreSQL (https://github.com/brianc/node-postgres) but it is written for Node.js and I doubt it will work in JavaScript Core or Chrome. CouchDB works via a REST API and it's actually intended for direct access by multiple clients. There are multiple JavaScript clients available for that.
BUT why do you want your clients to connect to the DB directly? What you describe seems like a pretty standard application model. You'll just need a backend running on your server talking to the DB and providing an API. Good old web development. If you want to write JavaScript on the backend I suggest using Node.js
If you really can't or don't want to write a backend, there are several services that provide API for data storage and even some data processing. But of course they aren't local. Have a look at parse.com or firebase.com for example.