jdbc_response - creating a connection to a PostgreSQL database

book

Article ID: 34407

calendar_today

Updated On:

Products

NIMSOFT PROBES DX Infrastructure Management

Issue/Introduction

This article provides instructions on how to create a connection to a PostgreSQL database using the jdbc_response probe.
Depending on OS(Windows/Linux) and *NIX flavor (RPM-based or Debian-based), configuration may vary (please refer to your platform's PostgreSQL documentation).

Environment

jdbc_response probe any version.

Resolution

Part I - On PostgreSQL database server:

Generally PostgreSQL configuration file is postgresql.conf

1- Enable Remote access for PostgreSQL:

a. In postgresql.conf, make PostgreSQL Listen on ethernet IP address:
listen_addresses = '10.0.0.2' 

b. Enable remote access from jdbc_response probe robot:
In pg_hba.conf
host all all 10.0.0.31/24 password

c. Restart PostgreSQL database service:
# /etc/init.d/postgresql restart


2- Create/allow PostgreSQL monitoring user:

a. Login to PostgreSQL using 'psql' command as an admin user
$psql -U pguser -W

Enter password for the PostgreSQL admin user

b. Create PostgreSQL monitoring user:
postgres =# createuser dbuser with password 'password';


c. Grant new user access to monitored databse: 
postgres=# grant all on database pgdb to dbuser;


Part-II - On 'jdbc_response' probe Robot:

1. Download PostgreSQL JDBC Driver from PostgreSQL site:
http://jdbc.postgresql.org/download.html

2. Rename downloaded jar file to pg.jar for your convenience to use driver name

3. Copy pg.jar to \probe\database\jdbc_response\jar\

4. In jdbc_response probe connection properties, it should look like this.

Database URL: jdbc:postgresql://10.0.0.2:5432/pgdb
Driver Name: org.postgresql.Driver
Driver Path: /Program Files/Nimsoft/probes/database/jdbc_response/jar/pg.jar
User ID: dbuser
Password: dbuser_password


You should now be able to connect PostgreSQL Server database using the jdbc_response probe.

Additional Information

1- Make sure you have JRE installed on jdbc_response probe robot. 
2- On PostgreSQL server, modify firewall rules to allow connection to PostgreSQL port (default is 5432/tcp).
3- URL to jdbc driver could be outdated then you can find the latest from the internet.