Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Oracle 12C - Connecting Applications from your Desktop to a database on VirtualBox

If you have your Oracle VM VirtualBox setup and running there is a possibility that you may need to setup the network for the Virtual Machine to make it accessible from the host machine (Desktop or Laptop). This may be needed when you want to connect your local applications to the database running on the VM VirtualBox.
When the VM is initially created on the VirtualBox, the network is not set up. But it’s not difficult to make it work though. We will look at two ways you can do that.

Using Bridged Network Adapter

By default, a VM uses the NAT adapter. NAT does the job of a network adapter, one in particular is enabling the VM allowing you to use the internet via host. However it does not allow you to connect to the VM from your host machine. The easiest way to achieve this is to configure another Network Adapter.
To achieve this, select your VM and go to Settings menu –> Network. Click on the Adapter 2 tab, enable it and make sure that Bridged Adapter is selected. You don’t need to change anything else.
VBox Network Adapter Config
Turn on your VM. Open a terminal and get the IP address of second adapter. Normally it will be named as eth1.
$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:D6:26:E3
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fed6:26e3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:19 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11685 (11.4 KiB) TX bytes:3019 (2.9 KiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:06:64:4F
inet addr:192.168.2.69 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fd00::a00:27ff:fe06:644f/64 Scope:Global
inet6 addr: fe80::a00:27ff:fe06:644f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15 errors:0 dropped:0 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2316 (2.2 KiB) TX bytes:1366 (1.3 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)
In the example above, the IP address we are looking for is the device eth1 which is 192.168.2.69. You can use this to make connections to your Virutal Machine. I tested it using Putty as a sample application because this is one application that serves me the most.
Accessing guest from Putty

Using Port Forwarding

The method above is simple but it has one limitation which is that every time when you restart your VM, a different IP address may be assigned. That’s particularly a hassle if you have saved connections. You may have to change them every now and then. To avoid this, the other option to achieve the same functionality is to setup Port Forwarding. In Port Forwarding, you enable your VM to take the requests which were originally meant for your local host. This setup is also pretty simple and straight forward.
Select the VM and open the Setting menu –> Network. On your NAT Adapter, expand the Advanced Settings and click on Port Forwarding. Enter the details in the dialogue box as shown below.
VM Port Forwarding
Here you are setting your VM to start accepting connections which are originally directed to 127.0.01:22 (localhost:22). Click OK and turn on your VM.
Now you don’t need any IP address to make connections. Just use localhost:22 as host name and port – all connections will be directed towards the VM. As shown below I am doing the same to connect to VM using Putty.
VM connecting Putty
Provide the username and password.
login as: oracle
oracle@localhost's password:
Last login: Sat Mar 22 15:53:16 2014 from 10.0.2.2
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Sat Mar 22 15:55:32 2014

Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics, Real Application Testing and Unified Auditing options

Connection successful!




Comments

Popular posts from this blog

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

Oracle to Postgresql migration

PostgreSQL Enterprise Manager - PEM Monitoring Tools

7 Steps to configure BDR replication in postgresql