Page 1 of 1

Connect Squirrel to PostgreSQL using VirtualBox

Posted: 22. May 2019, 23:46
by giannino1995
My configuration is this:
Windows 10 -> VirtualBox + Squirrel + JDBC
VirtualBox -> Ubuntu 18 + PostgreSQL
I would like to connect Squirrel with PostgreSQL.
I followed this guide:
https://www.digitalocean.com/community/ ... untu-18-04
I tested PostgreSQL and Squirrel separately and they work so I think the problem is VirtualBox.
I wanted to know if on VirtualBox the configuration you find attached is correct and if there is anything else to do to configure VirtualBox correctly.
I also discovered that there are two port forwarding buttons and I would like to know which one I should use.
1) File -> Preferences -> Network
2) File -> Settings -> Network -> Advanced
I used the number 2. Is that right?
Thank you

Re: Connect Squirrel to PostgreSQL using VirtualBox

Posted: 23. May 2019, 00:45
by scottgus1
If you wish to just have the host OS and the guest OS talk to each other, and don't need internet in the guest, use Host-Only networking. Host-Only puts private network "card" in your host OS that allows network activity to any guests attached to that host-only network, without the need for port forwarding.

If you want to include other PCs in your physical network in the conversation with the guest, and you want internet in the guest, use Bridged. Bridged will put your guest in your existing physical network as another PC, and all your computers and the guest can talk to each other, no port forwarding required. (be aware that if you Bridge your guest to a host Wi-fi adapter, Wi-fi doesn't technically know how to Bridge, depending on wi-fi adapter drivers or wireless access point firmware. You may need to Bridge to a host's plugged-in-and-working wired network adapter if wi-fi doesn't work.)

Note that with these two, any static ip setups in your guest OS will have to be undone, so the guest can get an ip address from the network. The host-only network will be in the 192.168.56.### range, with the host at 192.168.56.1 and the guest defaulting to 192.168.56.101. Bridged will put your guest in so the physcal network router gives it an ip address. Use the guest OS to find out what ip address it has and use that ip address to talk to your guest and your host's ip address for the guest to talk to the host.

NAT and NAT network require the port forwarding. If you really want the port forwarding and you have only one guest, use NAT. The port forwarding for NAT is in the guest's Network Settings page, where you can set to Bridged/Host-only/NAT/etc. There is a button at the bottom for port forwarding when NAT is chosen. set ypur ports there, then communicate with the guest at 10.0.2.15:port# or 127.0.0.1:port#

If you have more than one guest you need in the NAT, use NAT network. Port forwarding will be in the main Virtualbox window's Networking settings.

Re: Connect Squirrel to PostgreSQL using VirtualBox

Posted: 23. May 2019, 00:57
by socratis
[color=#3366CC]scottgus1[/color] wrote:Wi-fi doesn't technically know how to Bridge
[color=#00AA00]socratis[/color] wrote:Wi-fi isn't allowed technically to Bridge
There, I fixed it for you... ;)

The WLAN protocol is a 1-to-1 one, on a MAC address basis. The ones that follow the specification, fail. The ones that were lax on the spec and allowed more than 1 MAC addresses to talk, are the ones that work. Strange how the "outlaws" are actually a better choice. :)

Re: Connect Squirrel to PostgreSQL using VirtualBox

Posted: 24. May 2019, 17:52
by giannino1995
scottgus1 wrote:If you wish to just have the host OS and the guest OS talk to each other, and don't need internet in the guest, use Host-Only networking. Host-Only puts private network "card" in your host OS that allows network activity to any guests attached to that host-only network, without the need for port forwarding.

If you want to include other PCs in your physical network in the conversation with the guest, and you want internet in the guest, use Bridged. Bridged will put your guest in your existing physical network as another PC, and all your computers and the guest can talk to each other, no port forwarding required. (be aware that if you Bridge your guest to a host Wi-fi adapter, Wi-fi doesn't technically know how to Bridge, depending on wi-fi adapter drivers or wireless access point firmware. You may need to Bridge to a host's plugged-in-and-working wired network adapter if wi-fi doesn't work.)

Note that with these two, any static ip setups in your guest OS will have to be undone, so the guest can get an ip address from the network. The host-only network will be in the 192.168.56.### range, with the host at 192.168.56.1 and the guest defaulting to 192.168.56.101. Bridged will put your guest in so the physcal network router gives it an ip address. Use the guest OS to find out what ip address it has and use that ip address to talk to your guest and your host's ip address for the guest to talk to the host.

NAT and NAT network require the port forwarding. If you really want the port forwarding and you have only one guest, use NAT. The port forwarding for NAT is in the guest's Network Settings page, where you can set to Bridged/Host-only/NAT/etc. There is a button at the bottom for port forwarding when NAT is chosen. set ypur ports there, then communicate with the guest at 10.0.2.15:port# or 127.0.0.1:port#

If you have more than one guest you need in the NAT, use NAT network. Port forwarding will be in the main Virtualbox window's Networking settings.
Thank you very much, what you write is very clear and also supports my network setting (NAT). So, if my network setup is correct, where am I wrong in your opinion?
On SQuirrel I use these connection parameters:
Url: jdbc:postgresql://127.0.0.1:5432/name_db
User: user_db
Password: *********
that as you write are correct!
On VirtualBox I have several virtual OSs but I only use one at a time so I believe that I don't have to use "NAT network" but only "NAT". Is it correct what I understood? Do I have to use "NAT network"?
On VirtualBox I also find "internal network" and "generic driver", these options in which cases are they used?

Re: Connect Squirrel to PostgreSQL using VirtualBox

Posted: 24. May 2019, 17:59
by giannino1995
socratis wrote:The WLAN protocol is a 1-to-1 one, on a MAC address basis. The ones that follow the specification, fail. The ones that were lax on the spec and allowed more than 1 MAC addresses to talk, are the ones that work. Strange how the "outlaws" are actually a better choice. :)
Thank you very much for the clarification, you are very prepared!
I am also a bit "outlaw" in this configuration because I'm not an expert but have not been equally lucky.