-
Notifications
You must be signed in to change notification settings - Fork 7
Java
Dmitry Romanov edited this page Oct 26, 2017
·
5 revisions
Java API allows one to read RCDB condition values for the run. It doesn't provide possibility of run selection queries at this point.
Java API comes as sources (in Kotlin) and as ready to use Java precompiled .jar file
- Java API is located in $RCDB_HOME/java directory.
- Precompiled jar is located in $RCDB_HOME/java/out/artifacts
The example shows how to get values from RCDB:
import org.rcdb.*;
//...
// Connect to the database
// The real HallD database is going to be used for the example
JDBCProvider provider = RCDB.createProvider("mysql://[email protected]/rcdb");
provider.connect();
// get event count as a long value for run number 31000
long eventCount = provider.getCondition(31000, "event_count").toLong();
System.out.println("event_count = " + eventCount);
Here is the list of condition to[Type] functions and what values they are for:
Long toLong(); /// 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 are located in $RCDB_HOME/java/src/javaExamples folder.
Simple example - shows how to read values from database and lists all condition types from DB
$RCDB_HOME/java/src/javaExamples/SimpleExample.java
There are also an example written in $RCDB_HOME/java/src/kotlinExamples/main.kt
Getting started & basic usage:
- Installation
- Select values tutorial (python)
- Query syntax
- Add data (python)
- CLI Basics
RCDB Explained:
- Connection
- DB and APIs structure
- SQL examples
- Creating condition types
- Adding condition values
- Saving files
- SQLAlchemy
- Logging
- Performance
Command line tools:
DAQ: