Verifying Database Connectivity

How to troubleshoot issues occurring when querying a database with Monitoring Studio's Database Query Analysis feature.

Related Topics

Introduction

This article explains the procedure to follow if you encounter issues while querying your database using Monitoring Studio’s Database Query Analysis feature.

Procedure

To connect to the database and execute the query, Monitoring Studio v9.4 and higher uses the SEN_MS_matsya-module-jdbc.jar file located in PATROL_HOME\bin. If you are unable to query the database, manually run SEN_MS_matsya-module-jdbc.jar on the PATROL agent as described below:

    C:\BMCSOF~1\Patrol3\bin>java -jar SEN_MS_matsya-module-jdbc.jar
    SEN_MS_matsya-module-jdbc.jar: Error: You must specify a SQL statement to be executed

Usage: java -jar SEN_MS_matsya-module-jdbc.jar <JDBC URL> <-username:<username>> <"SQL statement"> [options...]

where:

  • <JDBC URL> is the JDBC URL to connect to the database (see examples below)
  • <username> is the user login used to connect to the database
  • <"SQL statement"> is the SQL statement to be executed by the database

Options:

  • password:<password> to specify the password on the command line (not recommended)
  • driver:<driverClass> to specify the class of the driver to load to perform the JDBC query
  • colsep:<column separator> to specify the char used to separate columns in the result (default: ‘;’)
  • showWarnings:<yes|no> to get the PRINT messages and warnings in the result (default: YES)
  • timeout:<timeout> to specify the timeout in seconds

Examples:

Oracle

Using Database Name

java -jar SEN_MS_matsya-module-jdbc.jar jdbc:oracle:thin:@hostname:1521:databaseName -username:admin "SELECT table_name FROM all_tables"

Using Service Name

java -jar SEN_MS_matsya-module-jdbc.jar jdbc:oracle:thin:@hostname:1521/serviceName -username:admin "SELECT table_name FROM all_tables"

Example

      pe's password:```

*** Microsoft SQL Server ***

```java -jar SEN_MS_matsya-module-jdbc.jar jdbc:jtds:sqlserver://hostname/master;instance=instanceName -username:admin "SELECT * FROM sysdatabases"```

*** PostgreSQL ***

```java -jar SEN_MS_matsya-module-jdbc.jar jdbc:postgresql://hostname:5432/postgres -username:admin "SELECT datname FROM pg_database;"```

*** MySQL ***

```java -jar SEN_MS_matsya-module-jdbc.jar jdbc:mysql://hostname:3306/mysql -username:admin "SELECT user From user;"```