Class SimpleDbPersistenceManager
- java.lang.Object
-
- org.apache.jackrabbit.core.persistence.AbstractPersistenceManager
-
- org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager
-
- org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager
-
- All Implemented Interfaces:
PersistenceManager
,DatabaseAware
- Direct Known Subclasses:
DerbyPersistenceManager
,MSSqlPersistenceManager
,OraclePersistenceManager
@Deprecated public class SimpleDbPersistenceManager extends DatabasePersistenceManager implements DatabaseAware
Deprecated.Please migrate to a bundle persistence manager (JCR-2802)SimpleDbPersistenceManager
is a generic JDBC-basedPersistenceManager
for Jackrabbit that persistsItemState
andNodeReferences
objects using a simple custom binary serialization format (seeSerializer
) 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 classurl
: the database url of the formjdbc:subprotocol:subname
user
: the database userpassword
: the user's passwordschema
: type of schema to be used (e.g.mysql
,mssql
, etc.);schemaObjectPrefix
: prefix to be prepended to schema objectsexternalBLOBs
: iftrue
(the default) BINARY values (BLOBs) are stored in the local file system; iffalse
BLOBs are stored in the database
getClass().getResourceAsStream(schema + ".ddl")
. Every line in the specified .ddl file is executed separately by callingjava.sql.Statement.execute(String)
where every occurrence of the the string"${schemaObjectPrefix}"
has been replaced with the value of the propertyschemaObjectPrefix
.The following is a fragment from a sample configuration using MySQL:
<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql:///test?autoReconnect=true"/> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="${wsp.name}_"/> <param name="externalBLOBs" value="false"/> </PersistenceManager>
The following is a fragment from a sample configuration using Daffodil One$DB Embedded:<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager"> <param name="driver" value="in.co.daffodil.db.jdbc.DaffodilDBDriver"/> <param name="url" value="jdbc:daffodilDB_embedded:${wsp.name};path=${wsp.home}/../../databases;create=true"/> <param name="user" value="daffodil"/> <param name="password" value="daffodil"/> <param name="schema" value="daffodil"/> <param name="schemaObjectPrefix" value="${wsp.name}_"/> <param name="externalBLOBs" value="false"/> </PersistenceManager>
The following is a fragment from a sample configuration using DB2:<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager"> <param name="driver" value="com.ibm.db2.jcc.DB2Driver"/> <param name="url" value="jdbc:db2:test"/> <param name="schema" value="db2"/> <param name="schemaObjectPrefix" value="${wsp.name}_"/> <param name="externalBLOBs" value="false"/> </PersistenceManager>
The following is a fragment from a sample configuration using MSSQL:<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager"> <param name="driver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/> <param name="url" value="jdbc:microsoft:sqlserver://localhost:1433;;DatabaseName=test;SelectMethod=Cursor;"/> <param name="schema" value="mssql"/> <param name="user" value="sa"/> <param name="password" value=""/> <param name="schemaObjectPrefix" value="${wsp.name}_"/> <param name="externalBLOBs" value="false"/> </PersistenceManager>
The following is a fragment from a sample configuration using Ingres:<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager"> <param name="driver" value="com.ingres.jdbc.IngresDriver"/> <param name="url" value="jdbc:ingres://localhost:II7/test"/> <param name="schema" value="ingres"/> <param name="user" value="ingres"/> <param name="password" value="ingres"/> <param name="schemaObjectPrefix" value="${wsp.name}_"/> <param name="externalBLOBs" value="false"/> </PersistenceManager>
The following is a fragment from a sample configuration using PostgreSQL:<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager"> <param name="driver" value="org.postgresql.Driver"/> <param name="url" value="jdbc:postgresql://localhost/test"/> <param name="schema" value="postgresql"/> <param name="user" value="postgres"/> <param name="password" value="postgres"/> <param name="schemaObjectPrefix" value="${wsp.name}_"/> <param name="externalBLOBs" value="false"/> </PersistenceManager>
JNDI can be used to get the connection. In this case, use the javax.naming.InitialContext as the driver, and the JNDI name as the URL. If the user and password are configured in the JNDI resource, they should not be configured here. Example JNDI settings:<param name="driver" value="javax.naming.InitialContext" /> <param name="url" value="java:comp/env/jdbc/Test" />
See alsoDerbyPersistenceManager
,OraclePersistenceManager
.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
driver
Deprecated.protected String
password
Deprecated.protected String
url
Deprecated.protected String
user
Deprecated.-
Fields inherited from class org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager
autoReconnect, blobDeleteSQL, blobFS, blobInsertSQL, blobSelectExistSQL, blobSelectSQL, blobStore, blobUpdateSQL, con, externalBLOBs, INITIAL_BUFFER_SIZE, initialized, nodeReferenceDeleteSQL, nodeReferenceInsertSQL, nodeReferenceSelectExistSQL, nodeReferenceSelectSQL, nodeReferenceUpdateSQL, nodeStateDeleteSQL, nodeStateInsertSQL, nodeStateSelectExistSQL, nodeStateSelectSQL, nodeStateUpdateSQL, propertyStateDeleteSQL, propertyStateInsertSQL, propertyStateSelectExistSQL, propertyStateSelectSQL, propertyStateUpdateSQL, schema, SCHEMA_OBJECT_PREFIX_VARIABLE, schemaObjectPrefix, SLEEP_BEFORE_RECONNECT
-
-
Constructor Summary
Constructors Constructor Description SimpleDbPersistenceManager()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Connection
getConnection()
Deprecated.Returns a JDBC connection acquired using the JDBCDriverManager
.String
getDriver()
Deprecated.String
getPassword()
Deprecated.String
getUrl()
Deprecated.String
getUser()
Deprecated.void
setConnectionFactory(ConnectionFactory connnectionFactory)
Deprecated.void
setDriver(String driver)
Deprecated.void
setPassword(String password)
Deprecated.void
setUrl(String url)
Deprecated.void
setUser(String user)
Deprecated.-
Methods inherited from class org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager
buildSQLStatements, checkSchema, close, closeConnection, closeResultSet, closeStatement, createSchemaSql, destroy, destroy, destroy, executeStmt, exists, exists, existsReferencesTo, getSchema, getSchemaDDL, getSchemaObjectPrefix, init, initConnection, initPreparedStatements, isExternalBLOBs, isSchemaCheckEnabled, load, load, loadReferencesTo, logException, prepareSchemaObjectPrefix, reestablishConnection, resetStatement, setExternalBLOBs, setExternalBLOBs, setSchema, setSchemaCheckEnabled, setSchemaObjectPrefix, store, store, store, store
-
Methods inherited from class org.apache.jackrabbit.core.persistence.AbstractPersistenceManager
checkConsistency, createNew, createNew
-
-
-
-
Method Detail
-
setConnectionFactory
public void setConnectionFactory(ConnectionFactory connnectionFactory)
Deprecated.- Specified by:
setConnectionFactory
in interfaceDatabaseAware
-
getUrl
public String getUrl()
Deprecated.
-
setUrl
public void setUrl(String url)
Deprecated.
-
getUser
public String getUser()
Deprecated.
-
setUser
public void setUser(String user)
Deprecated.
-
getPassword
public String getPassword()
Deprecated.
-
setPassword
public void setPassword(String password)
Deprecated.
-
getDriver
public String getDriver()
Deprecated.
-
setDriver
public void setDriver(String driver)
Deprecated.
-
getConnection
protected Connection getConnection() throws RepositoryException, SQLException
Deprecated.Returns a JDBC connection acquired using the JDBCDriverManager
.- Overrides:
getConnection
in classDatabasePersistenceManager
- Returns:
- new connection
- Throws:
SQLException
RepositoryException
- if the driver could not be loadedSQLException
- if the connection could not be established- See Also:
DatabasePersistenceManager.getConnection()
-
-