Skip to content
Dmitry Romanov edited this page Oct 23, 2017 · 5 revisions

RCDB Java API overview

Java API allows one to read RCDB condition values for the run. It doesn't provide possibility of run selection queries at this point.

Installation

Java API comes as sources (in Kotlin) and as ready to use Java precompiled .jar file


Getting values

The example shows how to get values from RCDB:

// Connect
Connection con("mysql://rcdb@hallddb/rcdb");

// Get event_count for run 10173
auto cnd = prov.GetCondition(10173, "event_count");

// Check event_count has a value for the run
if(!cnd) {
   std::cout<< "event_count condition is not set for the run"<<std::endl;
   return;
}

// Get value!
event_count = cnd->ToInt();

Here is the list of condition ToXXX functions and what values they are for:

Int toInt();                           /// For int values
Bool toBool();                         /// For bool or int in DB
Double toDouble();                     /// For Double or int in DB
String toString();                     /// For Json, String or Blob
Date   toDate();                       /// For time value

org.rcdb.ValueTypes                    /// type enum

Examples

Examples are located in $RCDB_HOME/java/examples folder.


List of examples: