SLAC ESD Software Engineering Group
Stanford Linear Accelerator Center

Oracle Database Provider Guide

SLAC Detailed
SLAC Computing
Software Home
Software Detailed

This page provides documentation for users and programmers of AIDA's Relational Database Data Provider. At present the only Relational Database (RDB) the Aida knows about is SLAC's Oracle database, so really "relational database" and "Oracle" can be used interchangebly below.

See Also: Basic Users Guide to Aida.

Users Guide

This section describes what an AIDA user should know about accessing Oracle database data through AIDA. For general information on using AIDA see Basic Users Guide to Aida, and the Aida javadoc, in particular the classes DaObject and DaReference (and DaReference's parent _DaReference) in aida.lib.da which form Aida's programming interface. One can also use Matlab.

Table 1: Summary of AIDA Data Provider for Oracle Data

Acquires data, from Oracle, for the named Aida Instance//Attribute. Aida's Directory Service makes the translation between what you ask for (the Aida Instance//Attribute), and the correct Oracle statement to acquire the data form Oracle (probably a SELECT statement). It then passes that translated statement to the Aida Oracle server to actually acquire the data, and Aida returns the result to you.
Status and limitations Simple database retrieval of values, where AIDA's AIDA_NAMES table contains the equivalent SELECT statement for a given instance//attribute, is complete. Addition of support for stored procedures, compiled queries, parameterized queries, free-form queries, is envisaged and can be added when necessary. Setting values in Orace (SQL update) has not yet been implemented, but would be easy to add.
Plan Add string substitution or parametized query soon.

% A simple query in matlab. This gets 6 vectors of data, but we just want the 
% element names (Strings) and Z positions (doubles), from the 1st and 
% 4th vector respectively.
% Connect to Aida
da = DaObject();

% Get the BSA Names. For this specific query, this will return a 
% vector of 6 vectors.
v = da.getDaValue('LCLS//BSA.elements.byZ'); 

% Extract the number of BSA element names returned (the number of rows)
Mrows = v.get(0).size(); 

% Extract just the element names and Z positions.
elements = char(v.get(0).getStrings());                      
Zs = v.get(3).getDoubles();                      
Java $CD_SOFT/ref/package/aida/test/java/
Matlab $CD_SOFT/ ref/package/aida/test/matlab/oracleBSAelements.mThere are other oracle*.m examples too.

Types Description
Get Syntax <instance>//<attribute> - Name is completely freeform until we have defined some standards.
Examples LCLS//BPMSnames
Set Syntax Setting data in Oracle through Aida is not enabled yet
Examples None
Instance Attributes
Attribute Description
<attribute> Gets Oracle data for a named Oracle query ("query").
Methods Name* Returns
getDaValue(query) DaValue is a Java Vector of Vectors, encapsulating the table produced by the SQL query equivalent to the Aida query given. Each inner vector gives the data for one column, and the outer vector is then the vector of all columns. Extrac the data with methods of java.util.Vector such as get() and DaValue (which extends Vector).

* See DaObject and DaReference (and DaReference's parent _DaReference) in aida.lib.da for full API and method signatures.

[SLAC ESD Software Engineering Group][ SLAC Home Page]

Author: Greg White 24-Jun-2008