PostgreSQL – Share data on Network drive

All we need is an easy explanation of the problem, so here it is.

I currently use a simple Microsoft Access database, stored on the company Network Drive, for my department’s data needs. This works quite well as everybody in my team has access to the shared folder where the database is stored, and can thus query it easily at anytime.

I’m now trying to replace this Microsoft Access database by a PostgreSQL database, but I’m a bit puzzled as to how to create a similar "shared" database in PostgreSQL. I currently have a PostgreSQL server hosted at "localhost", but from what I understand; this is an instance running on my own computer which becomes unavailable as soon as I shut down my computer.

So, my question is: what is the best practice to share data with colleagues (using PosgreSQL) so everyone can connect and interact with it at any time, and so everyone always has the latest updated data?

Thanks a lot!

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

I’m a bit puzzled as to how to create a similar "shared" database in PostgreSQL.

(Sorry if this is a bit "down" on MS Access but …)
Let’s start with a fundamental Truth about [proper] databases:

Database != File 

You should think of a database as a process that runs on a machine and does work on behalf of other applications. [Largely] Forget about the fact that there are files underneath it. Treat it as a logical thing. Use database tools for database tasks (no copying database files around while the cluster in running, for example!)

To share your postgres cluster, you start the postmaster process and then connect to that running process using a Postgres-compatible client. Interactively, that’s often psql.

… this is an instance running on my own computer which becomes unavailable as soon as I shut down my computer.

Correct.
You need to acquire a server machine that you can leave running all the time, on which you install and operate PostgreSQL.
This has the added benefit that you can have both your locally running instance, in which you can develop and test things and a separate Production instance, where the real thing runs and that everyone else uses (and neither can "break" the other).

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply