javalinuxoracleoracle19coraclelinux

Couldn't connect to oracle db 19 from virtualbox


My host machine is Ubuntu 20.04. I have an installed Oracle 8.5 tty version on my VirtualBox which I used oracle database 19.3.0. I have a bridge connection to my Oracle Linux and a second adapter as a 'host-only adapter'. I configured my listener - listener.ora in the following way. (test.max.com is my hostname)

enter image description here

and my tnsnames.ora

enter image description here

I checked my port 1521 whether it is open or not. I used this command. netstat -an | grep $1521 enter image description here

then I tried to connect java from my host machine(Ubuntu), I used the 'thin' client option, via bridge adapter. So I was stuck on a 'The network adapter could not establish connection' error.

P.S. I also tried the connection using a host-only adapter, before connecting I used the ping command IP of the host-only adapter, but it froze and it didn't show anything.


Solution

  • host/guest connectivity issues

    Suggesting you have some network connectivity problem from your vm-host to your vm-guest.

    1. In vm-host open firewall port 1521 for outgoing/outbound packets.

    2. In vm-guest open firewall port 1521 for incoming/inbound packets.

    In vm-guest run ip a command, to identify the IP4 addresses of vm-guest.

    1. I suggest to test connectivity from vm-host to vm-quest using ping command on each vm-guest IP4 address.

    Once you have network connectivity established.

    1. Check Oracle's network listener status in vm-guest using lsnrctl status tool documented here.

    Use containter instead of a vm

    Assuming your vm-host is Linux machine, suggesting to load a prepared Docker container installed and configured with Oracle database from Oracle or Docker hub.