Can't connect to a remote DB2 using a virtual machine - perl

I have a perl script running on a Debian virtual machine on VMWare. This script is supposed to connect to a DB2 database running on my Windows 7. When I try to connect with that string:
my $dbh = DBI->connect("dbi:DB2:DATABASE='nmap'; HOSTNAME='192.168.252.167'; PORT='50000'; PROTOCOL=TCPIP; UID='db2admin'; PASSWORD='password'";
The program returns an error and it says that db2 is not installed on Debian. How can I tell my script that the DB is running on a different machine? The virtual machine has a bridged connection with 192.168.252.178 as IP address.

You need the DBD::DB2 package installed on the client machine (your Debian VM in this case) if you want to connect to a DB2 database with DBI.

Related

Transactional replication from Linux server to Windows SQL Server

I have an Oracle Enterprise Linux server 7.8 and I am accessing it through putty software from my PC running Windows 10 OS. I have installed the same version of SQL Server on both the Linux server and my Windows PC.
What I am trying to do is a transactional replication where I want to set Linux server as both distributor and publisher and Windows PC SQL Server instance as subscriber.
So, my question is whether this is possible or not?
Because I have tried all possible way of my knowledge and still I was not able to configure replication successfully....

How can I connect to local database on a windows machine from a tomcat server on Ubuntu in a virtual machine

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?
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.

pgAdmin can't connect to database server

Database server os = Ubuntu 16.04
client machine= Windows os 8.
we are not able to connect database server from pagAdmin which I have installed on my laptop (while its prompting for password).
Have you configured "pg_hba.conf" file in the server for remote access? IF not, you need to add following in the file
# vi /var/lib/pgsql/data/pg_hba.conf
host all all 192.168.101.20/24 trust
192.168.101.20/24 is just an example, you need to write clients IP and port.

How to utilize GUI tool of pgadmin using vagrant

I have installed postgresql upon a vagrant ubuntu box and also companied control console with
sudo apt-get --assume-yes install pgadmin3
the tool is installed under /usr/bin
but I can not open pdadmin3 in the virtualbox due to the error
Error: Unable to initialize gtk, is DISPLAY set properly?
Could I possibly do this kind of thing in vagrant virtual box ? Or some work around
Run PgAdmin locally on your main desktop and connect to PostgreSQL on your Vagrant VM over TCP/IP.
The host can connect to guests if properly configured. You'll need to (a) ensure that Vagrant has suitable networking from host to guest, either using NAT and port forwards or using a virtual bridge; (b) ensure that PostgreSQL on the guest listens on all interfaces for TCP/IP connections using listen_addresses in postgresql.conf and (c) ensure that PostgreSQL on the guest is configured to allow connections from remote peers in pg_hba.conf.
Alternately, PgAdmin supports ssh tunnels. If you can ssh to the virtualbox you can configure PgAdmin to ssh to it too, then make a local PostgreSQL connection.
Personally I prefer to instead just use the psql command-line client for PostgreSQL directly on the VM. Way less hassle.

How to connect Pgadmin3 to a database on Virtualbox machine?

I have an Ubuntu Server with Postgresql server on Virtualbox machine (which runs on local machine), and Pgadmin3 on local machine.
Now how can I connect with Pgadmin3 to a database on Virtualbox? I am getting
"Server doesn't listen"
Postgres is actually running inside Virtualbox.
Found this out. To make it work, i did:
1) Edited file /etc/postgresql/9.1/main/postgresql.conf , uncommented and edited one line to contain:
listen_addresses = '10.10.4.14,localhost'
Where 10.10.4.14 is address used to access server on virtualbox.
2) Edited file /etc/postgresql/9.1/main/pg_hba.conf , added one line at the end:
host all all 10.10.4.14/24 md5
Note file path in your case might be different if your Postgres version is not the same as mine, or another linux distribution might place those files in other locations.