Connect Squirrel to PostgreSQL using VirtualBox

Discussions related to using VirtualBox on Windows hosts.

Connect Squirrel to PostgreSQL using VirtualBox

Postby giannino1995 » 22. May 2019, 23:46

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
Attachments
ggg.png
1) File -> Preferences -> Network
ggg.png (12.44 KiB) Viewed 53 times
fghdf.png
2) File -> Settings -> Network -> Advanced
fghdf.png (11.5 KiB) Viewed 53 times
giannino1995
 
Posts: 43
Joined: 28. Nov 2014, 22:11

Re: Connect Squirrel to PostgreSQL using VirtualBox

Postby scottgus1 » 23. May 2019, 00:45

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.
Human government is like that crazy uncle who hides a quarter in his fist behind his back, then asks you to guess which fist the quarter is in...
No matter which side you choose, Left or Right, both Sides are empty.
scottgus1
 
Posts: 3637
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Win7

Re: Connect Squirrel to PostgreSQL using VirtualBox

Postby socratis » 23. May 2019, 00:57

scottgus1 wrote:Wi-fi doesn't technically know how to Bridge
socratis 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. :)
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 23712
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Connect Squirrel to PostgreSQL using VirtualBox

Postby giannino1995 » 24. May 2019, 17:52

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?
giannino1995
 
Posts: 43
Joined: 28. Nov 2014, 22:11

Re: Connect Squirrel to PostgreSQL using VirtualBox

Postby giannino1995 » 24. May 2019, 17:59

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.
giannino1995
 
Posts: 43
Joined: 28. Nov 2014, 22:11


Return to VirtualBox on Windows Hosts

Who is online

Users browsing this forum: No registered users and 32 guests