BRMS连接数据库(原创)

    BRMS有两种方法存放数据,一种是存在文件中(默认),一种是存到数据库中,下面介绍第二种方法的配置,以Oracle为例。
     BRMS是使用Apache Jackrabbit存储数据的(Jackrabbit的介绍在其他以前的文章里有介绍),在tomcat里面启动以后会在tomcat主目录下生成两个文件(repository.xml、derby.log)和一个文件夹(repository),需要修改的是repository.xml和repository\workspaces\default下面的workspace.xml,实例如下:
repository.xml
<?xml version="1.0"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.4//EN"
                            "http://jackrabbit.apache.org/dtd/repository-1.4.dtd">
<!-- Example Repository Configuration File -->
<Repository>
    <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
        <param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
        <param name="url" value="jdbc:oracle:thin:@localhost:1521:myoracle" />
        <param name="user" value="***" />
        <param name="password" value="***" />
        <param name="schema" value="oracle"/>
        <param name="schemaObjectPrefix" value="fs_"/>
    </FileSystem>
    <Security appName="Jackrabbit">
        <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
        </AccessManager>

        <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
        </LoginModule>
    </Security>

    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
    <Workspace name="${wsp.name}">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
	        <param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
	        <param name="url" value="jdbc:oracle:thin:@localhost:1521:myoracle" />
	        <param name="user" value="***" />
	        <param name="password" value="***" />
	        <param name="schema" value="oracle"/>
	        <param name="schemaObjectPrefix" value="fs_w_"/>
	    </FileSystem>
        <PersistenceManager class="org.apache.jackrabbit.core.state.db.OraclePersistenceManager">
          	<param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
          	<param name="url" value="jdbc:oracle:thin:@localhost:1521:myoracle" />
            <param name="user" value="***" />
            <param name="password" value="***" />
            <param name="schema" value="oracle" />
            <param name="schemaObjectPrefix" value="pm_w_" />
            <param name="externalBLOBs" value="false" />
        </PersistenceManager>
        <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
            <param name="path" value="${wsp.home}/index"/>
            <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
            <param name="extractorPoolSize" value="2"/>
            <param name="supportHighlighting" value="true"/>
        </SearchIndex>
    </Workspace>

    <Versioning rootPath="${rep.home}/version">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
	        <param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
	        <param name="url" value="jdbc:oracle:thin:@localhost:1521:myoracle" />
	        <param name="user" value="***" />
	        <param name="password" value="***" />
	        <param name="schema" value="oracle"/>
	        <param name="schemaObjectPrefix" value="fs_v_"/>
	    </FileSystem>

        <PersistenceManager class="org.apache.jackrabbit.core.state.db.OraclePersistenceManager">
          	<param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
          	<param name="url" value="jdbc:oracle:thin:@localhost:1521:myoracle" />
            <param name="user" value="***" />
            <param name="password" value="***" />
            <param name="schema" value="oracle" />
            <param name="schemaObjectPrefix" value="pm_v_" />
            <param name="externalBLOBs" value="false" />
        </PersistenceManager>
    </Versioning>

    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
        <param name="path" value="${rep.home}/repository/index"/>
        <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
        <param name="extractorPoolSize" value="2"/>
        <param name="supportHighlighting" value="true"/>
    </SearchIndex>
</Repository>

workspace.xml和上面的配置差不多,就不说了。

你可能感兴趣的:(apache,oracle,tomcat,xml,Derby)