Access Postgres on Mac from Windows 10 on VMWare - postgresql

I have postgres running on my Mac (OSX 10.13.1). Running Windows 10 in a virtual machine on VMWare Fusion (8.5.8). Requirement is to access a postgres database from an app running on the Windows VM, but I'm having trouble finding documentation and specific instructions about how to configure Postgres appropriately--appreciate any help.
The connection should be secure, and limited to local if possible--really don't want to expose a connection to the external internet.
I gather that there are some configuration settings that need to be made in postgresql.conf as well as in pg_hba.conf.
Tried adding listen_address = '*' to the postgresql.conf file, and added host all all xxx.xx.xxx.x/24 md5 (where x's indicate the IP address for the virtual machine) in the pg_hba.conf file.
On the setup screen for the postgres driver on Windows, I'm not sure how to set the driver up to find the database.
Also: I found an IP address for the VM on the Mac terminal, but does that change every time the machine restarts, or can it be set to a constant value? I.e. I don't want to have to reset the configuration every time the machine restarts.
Thanks in advance.

Related

How can I connect to a Postgresql database (which is on my local machine) using dbeaver on my virtual machine?

I have created a postgresql database on my local machine and I want to connect to that database on my virtual linux(centos) machine. But I could not figure it out. What should I type in the host section ? (Link here)
You need to port forward the localhost to the virtual machine using something like this you need to enter your host and guest IPs and ports accordingly.

Postgres RDS access working on Mac, not Win 10

I have 2 computers (Win 10 and Mac) and need to access a RDS Postgres database. Connection is secure via a bastion host and ecs instance. When I configure TablePlus like this:
It works perfectly on the Mac but not on Windows. I checked a bit and recommendation is to create a tunnel via Putty to forward the port 5432 to a local one and then try to access the db with a local IP. But no success.
I would like to know if there is a specific setting in TablePlus or something I'm missing that will allow me to access the database on my Windows computer? I tried also with pgAdmin and same results.

How can I connect to local database on a windows machine from a tomcat server on Ubuntu in a virtual machine

I am trying to set up a server in a virtual machine using the Oracle VirtualBox. I use Ubuntu 18.04 LTS in the VirtualBox. I use PostgreSQL as my database.
In my Tomcat, I have a property file where I provide the database URL and password. I want the tomcat that is set up in the VirtualBox to be able to access a local database that is set up using PGAdmin in my Windows machine in which the VirtualBox is installed.
Is it possible to do that?
When connecting to a SQL server DB running on my host machine from a VM, I use the IP address to connect.
You can run ipconfig (or your OS's equivalent) to find the IP address of the machine serving the DB, then try to connect from your host machine via that IP address instead of the machine name.
There might be some VM-specific settings you need to tweak to allow network access between the VM and host, refer to this post for more info. Usually I have to set my VirtualBox network mode to bridged adapter.

Allow incoming Postgresql connections to a Mac from a VM

I'm running Postgresql 9.4 on my mac on MacOS Sierra (host) and Ubuntu 16.04 in Virtualbox (guest) and I can't seem to figure out how to allow the guest to access the host without completely disabling the firewall. I want to just allow incoming connections on port 5432 for postgres and I have added the postgres executable and psql executable to the firewall options list and without turning the firewall completely off (which I don't want to do because I'll forget to turn it back on) I can't access postgres.
Does anyone know how to add a rule to allow connections in this version of the MacOS?
As a side note, I've already configured the pg_hba.conf files and everything else to allow connections on my private network and everything works with the MacOS firewall off, I'd just prefer to have it on with the rules in place.

How to connect Pgadmin3 to a database on Virtualbox machine?

I have an Ubuntu Server with Postgresql server on Virtualbox machine (which runs on local machine), and Pgadmin3 on local machine.
Now how can I connect with Pgadmin3 to a database on Virtualbox? I am getting
"Server doesn't listen"
Postgres is actually running inside Virtualbox.
Found this out. To make it work, i did:
1) Edited file /etc/postgresql/9.1/main/postgresql.conf , uncommented and edited one line to contain:
listen_addresses = '10.10.4.14,localhost'
Where 10.10.4.14 is address used to access server on virtualbox.
2) Edited file /etc/postgresql/9.1/main/pg_hba.conf , added one line at the end:
host all all 10.10.4.14/24 md5
Note file path in your case might be different if your Postgres version is not the same as mine, or another linux distribution might place those files in other locations.