Example usage

In this example, the JDBC Probe is used to read events from an Oracle database.

To use the JDBC Probe to read events from an Oracle database, you need to identify the equivalent of the LastOccurrence field of the ObjectServer in the table that the JDBC Probe reads. You can then use this field as the MarkerColumn property in the JDBC Probe properties file.

The select statement that you specify using the SelectSqlFile property must compare the MarkerColumn with the local system time of the database. So that the JDBC Probe can use the MarkerColumn, it must be converted to a number (if it is not a number already).

The following configuration assumes that LastOccurrence is a date field in the table ORACLE_TABLE on the Oracle database <ORACLE_SID> on the server <ORACLE_SERVER_IP>. With the <probe-user> having the correct permissions and settings to access the table:

  1. Set the CLASSPATH environment variable to reflect the required Oracle JDBC client jar files:

    CLASSPATH=/opt/instantclient/classes12.jar:/opt/instantclient/ojdbc14.jar export CLASSPATH

  2. Set the following properties in the jdbc.props file:
    SelectSqlFile : ’$NCHOME/omnibus/probes/linux2x86/oracle11g_jdbc_probe.sql’
    MessageLog    : ’$NCHOME/omnibus/log/jdbc_probe_oracle11g.log’
    PidFile       : ’$NCHOME/omnibus/var/jdbc_probe_oracle11g.pid’
    JdbcDriver    : ’oracle.jdbc.driver.OracleDriver’
    JdbcUrl       : ’jdbc:oracle:thin:@<ORACLE_SERVER_IP>:1521:<ORACLE_SID>’
    DBUsername    : ’<probe-user>’
    DBPassword    : ’<probe-user-password>’
    DataBackupFile : ’$NCHOME/omnibus/var/jdbc_probe_oracle11g’
    MarkerColumn   :
    "TO_NUMBER(TO_CHAR(LASTOCCURRENCE ,’yyyymmddhh24miss’)) AS MARKER"
    
  3. Define a select statement in the SQL file (oracle11g_jdbc_probe.sql) specified by the SelectSqlFile property suitable for the target table ORACLE_ALERTS:

    select TO_NUMBER(TO_CHAR(LASTOCCURRENCE ,’yyyymmddhh24miss’)) as MARKER, IDENTIFIER, NODE, FIRSTOCCURRENCE, LASTOCCURRENCE from ORACLE_ALERTS