Using ODBC Datasources in VA2

VA2 can access any ODBC compliant data source. Data Sources can be used to execute and time SQL queries, access Siebel data, or as components of analysis rules and statitics to check buisness logic, or custom monitoring routines. The requirements for using a ODBC datasource with VA2:
Once these steps are completed, several VA2 libraries with code examples are avalible below. The graphic below shows an example of adding a VA2 data source named "NewData". When you add a new VA2 Data Source, you pick from the availblie data sources availible on the machine where your MMC Console is running. For this reason, new VA2 Data Sources should be created on the same manchine as the VA2 Central Server. Also, on creating a new Data Source, it should be tested, and the VA2 Central Server will need to be restarted to initialize the connection.

Note in the example above, the new data source created has an Alias of "NewData". We will use this Alias to access the data source in VA2 code.

Example 1 - Access Siebel data

In Example 1, we use the VA2 library sqlanalyze. The code is simple - just set a SQL statement and execute it.
use sqlanalyze;
my $sql = "select count(*) from S_DCK_TXN_LOG";   # modify SQL as necessary- for Oracle may need to add table owner

$retval = sqlanalyze->sqlcount($sql, $datasource{siebeldata});

When calling the ->sqlcount method, we must pass in the name $datasource{} parameter. In that parameter, we provide a string to match the Alias proprerty of a VA2 data source. So if the datasource is named siebeldata - we pass in $datasource{siebeldata}. If it was named NewData, we would pass in $datasource{NewData}

Example 2 - Time a SQL Query

This example shows code that executes a SQL statment and times the result. Link and code here.

Example 3 - Oracle Administration

This example shows code that monitors shared pool space in Oracle. Link and code here.

Example 4 - Understanding $datasession

$datasession is a data session internal to VA2. It is used to access the VA2 repository tables, and does not appear in the VA2 Data Sources tab in the MMC. It can be used to execute SQL queryies on VA2 tables, including the Siebel monitoring tables, Statitics, and VA2 Event Table - errorevent.
use sqlanalyze;

my $sql = "select count(*) from errorevent";

$retval = sqlanalyze->sqlcount($sql, $datasession);