0

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?

Geo Thomas
  • 1,139
  • 3
  • 26
  • 59

1 Answers1

2

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.