Use of an SDB store requires a Store object which is described in
two parts:
These can be built from a Jena assembler description.
Store objects themselves are lightweight so connections to an SDB database can be created on a per-request basis as required for use in J2EE application servers.
A store description identifies which storage layout is being used, the connection to use and the database type.
[] rdf:type sdb:Store ; sdb:layout "layout2" ; sdb:connection <#conn> . <#conn> ...
SDB connections, objects of class SDBConnection, abstract away
from the details of the connection and also provide consist logging
and transaction operations. Currently, SDB connections encapsulate
JDBC connections but other connection technologies, such as direct
database APIs, can be added.
The sdbType is needed for both a connection and for a store
description. It can be given in either part of the complete store
description. If it is specified in both places, it must be the
same.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . @prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> . <#myStore> rdf:type sdb:Store ; sdb:layout "layout2" ; sdb:connection <#conn> ; . <#conn> rdf:type sdb:SDBConnection ; sdb:sdbType "derby" ; sdb:sdbName "DB/SDB2" ; sdb:driver "org.apache.derby.jdbc.EmbeddedDriver" ; .
Examples of assembler files are to be found in the Store/
directory in the distribution.
The value of sdbType needed for the connection also applies to
choosing the store type.
layout
~ Layout type (e.g. "layout2", "layout2/hash" or
"layout2/index").
connection
~ The object of this triple is the subject of the connection
description.
engine
~ Set the MySQL engine type (MySQL only).
sdbTypesdbNamesdbHostsdbUsersdbPasswordSDB_USER and SDB_PASSWORD are a better way to pass in the user
and password because they are not then written into store
description files. In Java programs, the system properties
jena.db.user and jena.db.password can be used.driversdbType to find the driver. Setting this property overrides that
choice.jdbcURLsdbType is still needed.