folks,
i added a example for a db-based persistence manager in the
contrib/db-persistence directory.
i wouldn't recommend it for production use, it's thought as an
example/proof of concept to demonstrate the following points:
- simple (if not to say primitive;) schema, using custom bianry serialization
format (-> ObjectPersistenceManager)
- generic
- automatic schema creation (easy deployment)
- transactional
- ok performance
i successfully tested it with mysql & mssql.
basic docu copied from java doc:
SimpleDbPersistenceManager is a generic JDBC-based PersistenceManager
for Jackrabbit that persists ItemState and NodeReferences objects
using a simple custom serialization format and a very basic
non-normalized database schema (in essence tables with one 'key' and
one 'data' column).
It is configured through the following properties:
- driver: the FQN name of the JDBC driver class
- url: the database url of the form jdbc:subprotocol:subname
- user: the database user
- password: the user's password
- schema: type of schema to be used (e.g. mysql, mssql, etc.);
- schemaObjectPrefix: prefix to be prepended to schema objects
The required schema objects are automatically created by
executing the DDL
statements read from the [schema].ddl file. The .ddl file
is read from the resources
by calling getClass().getResourceAsStream(schema +
".ddl"). Every line in the
specified .ddl file is executed separatly by calling
java.sql.Statement.execute(String) where every occurence
of the the string
"${schemaObjectPrefix}" has been replaced with the value
of the property
schemaObjectPrefix.
The following is a fragment from a sample configuration:
<PersistenceManager
class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql:///test"/>
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="${wsp.name}_"/>
</PersistenceManager>
have fun,
cheers
stefan