SQLTuple provides AIDA
NTuple interface of SQL databases. It can support any SQL database
locally or over the networks. The current distribution is configures for
use with MySQL, PostgreSQL, McKoi and Oracle, but any other database
can be easily added. SQLTuple is based on FreeHEP
AIDA
implementation and is completely AIDA compliant and interoperable
with other AIDA components (so it can transparently use other AIDA
storages, like XML files and HBook or Root files (in read mode)). The
interaction with SQL is completely customizable at run-time via three
(textual) configuration files:
|
ColMan
provides Collection Management utilities on top of SQLTuple:
replicating, filtering, merging, analysing,... of Event Collection
metadata. It performs all manipulations via AIDA NTuple API. |
ColManReplicator
is one utility
(in fact one class) which uses SQLTuple API to replicate Atlas Geometry
databases. It simply reads AIDA NTuple from one database (e.g. Oracle)
and writes in into another (e.g. MySQL). This is possible as long as
tables use only SQL types which are supportable by SQLTuple AIDA
mapping. In
case those SQL types are not directly supported by default, a
customized mapping (using Type.properties configuration file) can be
easily provided as long as there is
one-to-one correspondence between tables and types in two used
technologies. Additional table characteristics (key, indexes, ...) can
be incorporated using StmtSrc.properties configuration file. ColManReplicator introduces certain overhead to replication by interpreting SQL tables as AIDA NTuples. This overhead, however, is not too big and enables transparent (network-wide) replication between various technologies (in principle any SQL database and file formats supportable by AIDA). Afterall, SQL tables have to be interpreted somehow to be replicated between different technologies. ColManReplicator is available from ColMan 0.9.6, which is installed as Atlas External package, but not yet available from releases. |
# Setup Java
. /afs/cern.ch/sw/java/share/bin/setjdk sun 1.5.0beta2 export PATH="${PATH}:${JAVA_HOME}/bin" # Write a file listing all tables to be replicated: tables.txt # (ColManReplicator can replicate the whole database too, but # that may be quite long operation for just testing) # For example: ALMN_DATA ALMN_DATA2VERS # Replicate Oracle tables into MySQL tables # (this works also to PostgreSQL, Cloudscape and others) java -jar /afs/cern.ch/atlas/offline/external/Colman/ColMan-0.9.6/lib/ColManReplicator.exe.jar jdbc:oracle:thin:@oradev9.cern.ch:1521:D9 jdbc:mysql://<mysql server>/<database> <oracle id> <oracle passwd> <mysql id> <mysql passwd> tables.txt # Replicate Oracle tables into AIDA file # (which can be then read by any AIDA tool) java -jar /afs/cern.ch/atlas/offline/external/Colman/ColMan-0.9.6/lib/ColManReplicator.exe.jar jdbc:oracle:thin:@oradev9.cern.ch:1521:D9 CollectionTest.aida <oracle id> <oracle passwd> <anything> <anything> tables.txt |
IAnalysisFactory af = IAnalysisFactory.create(); ITree inTree = af.createTreeFactory().create(inUrl, ...); ITree outTree = af.createTreeFactory().create(outUrl, ...); ITupleFactory tf = af.createTupleFactory(outTree); IFilter filter = tf.createFilter(true); String[] tables = inTree.listObjectNames(); ITuple inTuple; ITuple outTuple; for (String table : tables) { inTuple = inTree.find(table); outTuple = tf.createFiltered(table, inTuple, filter); } inTree.close(); outTree.commit(); outTree.close(); |
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(schema)) input = Sql.newInstance(inUrl, inUser, inPasswd, inDriver) output = Sql.newInstance(outUrl, outUser, outPasswd, outDriver) XPathAPI.selectNodeList(doc, "/database/table").each { output.execute(createStmt) input.eachRow(selectStmt) { output.execute(insertStmt) { } } |
xindice retreive_document -c xindice://xmldbhost.domain.org:8080/ATLAS/LAr/BarrelGeometry -n BarrelGeometry-02 -f File.xml |