<!-- @version $Id: repository_database.xml 513577 2007-03-02 02:33:44 +0100 (Fr, 02 Mrz 2007) arminw $ -->
<!--
/* Copyright 2002-2004 The Apache Software Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->
<!--
Define all database connections here.
One defined connection should be defined as the default one,
by setingt default-connection="true" - this could be done at runtime too.

It is possible to set user/password at
runtime or to let different users login at runtime
using the same database.
Use PBKey objects for the same jcdAlias name,
but with different user/password.

It is also possible to add jdbc-connection-descriptor elements
at runtime,  using the MetadataManager.
-->

    <!-- This connection is used as the default one within OJB -->
    <jdbc-connection-descriptor
   		jcd-alias="@JCD_ALIAS@"
   		default-connection="true"
   		platform="@DBMS_NAME@"
   		jdbc-level="@JDBC_LEVEL@"
   		driver="@DRIVER_NAME@"
   		protocol="@URL_PROTOCOL@"
   		subprotocol="@URL_SUBPROTOCOL@"
   		dbalias="@URL_DBALIAS@"
   		username="@USER_NAME@"
   		password="@USER_PASSWD@"
   		batch-mode="false"
        useAutoCommit="1"
        ignoreAutoCommitExceptions="false"
     >

        <!--
            If set 'true' OJB use the native database LIMIT and OFFSET syntax
            for limit and paging queries (if it's supported by the database and OJB's Platform
            implementation class). If set 'false' OJB simulate limit and paging by a specific
            result set iterator (this can result in bad performance on big result sets).
        -->
        <attribute attribute-name="nativeLimitOffset" attribute-value="true" />


        <!--
            To create identity objects for transient (non-persist) objects  OJB use
            a specific sequence manager implementation to generate transient key values.
            The default implementation is org.apache.ojb.broker.util.sequence.SequenceManagerTransientImpl.
            Use this property to plug in user specific implementations.
        -->
        <!--<attribute attribute-name="sequenceManagerTransient" attribute-value="my.SequenceManagerTransient" />-->

        <!-- ** Attributes with name prefix "platform." are used to allow database
        platform class specific settings (PlatformXYZImpl classes) -->

        <!-- If set to value >0 Oracle's implicit statement caching will be enabled by OJB (Oracle9i or higher).
        Number of cached statements per connection using implicit caching with Oracle9i Connections.
        See http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/jdbc30/StmtCacheSample/Readme.html-->
        <attribute attribute-name="platform.oracle.statementCacheSize" attribute-value="15" />

        <!-- Number of rows pre-fetched by the JDBC-driver for each executed query, when using row
        pre-fetching with Oracle Connections (Oracle9i or higher). Note: this setting can be overridden
        by specifying a connection-pool attribute with name="jdbc.defaultRowPrefetch".
        See http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/RowPrefetchSample/Readme.html -->
        <attribute attribute-name="platform.oracle.prefetchSize" attribute-value="20" />

        <!-- If set to value >0 Oracle's native batch statement handling will be enabled by OJB
        (Oracle9i or higher). If 0 or not specified the JDBC standard batch methods are used.
        See http://technet.oracle.com/products/oracle9i/daily/jun07.html -->
        <!--<attribute attribute-name="platform.oracle.batchSize" attribute-value="20" />-->


        <!-- Specify the ConnectionFactory implemenation:
        org.apache.ojb.broker.accesslayer.ConnectionFactoryDBCPImpl
        org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
        org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl
         -->
        <connection-factory
            class="org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl"
            validationQuery=""
        >
            <!-- ** Attributes with prefix "ojb." supported by all ConnectionFactory implementations -->
            <!-- Set fetchSize to 0 to use driver's default. -->
            <attribute attribute-name="ojb.fetchSize" attribute-value="0"/>
            <!-- Enable/disable OJB's internal statement caching. This make sense
            when the used jdbc-driver/ConnectionFactory doesn't support statement
            caching. The statements cached as long as the current used connection
            is returned to pool/closed. NOTE: It's recommended to disable OJB's statement
            caching if the jdbc-driver or the connection-pool statement-caching is enabled
             -->
            <attribute attribute-name="ojb.cacheStatements" attribute-value="false"/>
            <!-- If OJB's statement caching is enabled, this property set the max number
             of cached statements per connection -->
            <attribute attribute-name="ojb.maxCacheStatements" attribute-value="50"/>


            <!-- ** Attributes with name prefix "pool." supported by ConnectionFactoryPooledImpl
            and ConnectionFactoryDBCPImpl:
            (prefix 'pool.' is mandatory for all attributes, e.g. "pool.maxActive")
            "maxActive", "maxIdle", "minIdle", "maxWait", "whenExhaustedAction",
            "testOnBorrow", "testOnReturn", "testWhileIdle", "timeBetweenEvictionRunsMillis",
            "numTestsPerEvictionRun", "minEvictableIdleTimeMillis", "validationQuery",
            "softMinEvictableIdleTimeMillis", "initialSize"
            -->
            <attribute attribute-name="pool.maxActive" attribute-value="30"/>
            <attribute attribute-name="pool.maxIdle" attribute-value="-1"/>
            <attribute attribute-name="pool.maxWait" attribute-value="10000"/>
            <attribute attribute-name="pool.whenExhaustedAction" attribute-value="0"/>
            <attribute attribute-name="pool.testOnBorrow" attribute-value="true"/>
            <attribute attribute-name="pool.testOnReturn" attribute-value="false"/>
            <attribute attribute-name="pool.testWhileIdle" attribute-value="false"/>
            <attribute attribute-name="pool.timeBetweenEvictionRunsMillis" attribute-value="-1"/>
            <attribute attribute-name="pool.numTestsPerEvictionRun" attribute-value="10"/>
            <attribute attribute-name="pool.minEvictableIdleTimeMillis" attribute-value="-1"/>
            <attribute attribute-name="pool.initialSize" attribute-value="0"/>

            <!-- ** Additional attributes supported by ConnectionFactoryDBCPImpl:
            (prefix 'dbcp.' is mandatory for all attributes, e.g. "dbcp.poolPreparedStatements")
            "poolPreparedStatements", "maxOpenPreparedStatements", "accessToUnderlyingConnectionAllowed"
            "logAbandoned", "removeAbandoned", "removeAbandonedTimeout"
            -->
            <!--
            Attributes determining if ConnectionFactoryDBCPImpl
            should also pool PreparedStatement. This is programmatically disabled
            when using platform=Oracle9i since Oracle statement caching will conflict
            with DBCP ObjectPool-based PreparepdStatement caching (ie setting true
            here has no effect for Oracle9i platform). -->
            <attribute attribute-name="dbcp.poolPreparedStatements" attribute-value="true"/>
            <attribute attribute-name="dbcp.maxOpenPreparedStatements" attribute-value="50"/>
            <!-- Attribute determining if the Commons DBCP connection wrapper will allow
                 access to the underlying concrete Connection instance from the JDBC-driver
                 (if not specified, by default it's enabled). -->
            <attribute attribute-name="dbcp.accessToUnderlyingConnectionAllowed" attribute-value="true"/>
            <attribute attribute-name="dbcp.logAbandoned" attribute-value="false"/>
            <attribute attribute-name="dbcp.removeAbandoned" attribute-value="false"/>
            <attribute attribute-name="dbcp.removeAbandonedTimeout" attribute-value="300"/>


            <!-- ** Attributes with name prefix "jdbc." are passed directly to the JDBC driver. -->
            <!-- Oracle specific driver setting to enable oracle's specific statement batching.
             Oracle Docs: "The value of this property is used as the default batch
             size when using Oracle style batching."
             Attention: With OracleXE + thin this setting cause unexpected behavior -->
            <!--<attribute attribute-name="jdbc.defaultExecuteBatch" attribute-value="20"/>-->
            <!-- Oracle specific driver setting to set the default prefetch size.
             Oracle Docs: "The value of this property is used as the default number of rows to prefetch."
             Attention: With OracleXE + thin this setting cause unexpected behavior -->
            <!--<attribute attribute-name="jdbc.defaultRowPrefetch" attribute-value="20"/>-->

        </connection-factory>


        <!-- Specify the batch strategy and the batch manager implementation, the
         validator is used to check the 'execute batch' statement return array -->
        <batch class="org.apache.ojb.broker.accesslayer.batch.BatchManagerImpl"
            strategy="org.apache.ojb.broker.accesslayer.batch.BatchStrategyDefaultImpl"
            limit="50"
            validator="org.apache.ojb.broker.accesslayer.batch.ReturnValueValidatorImpl"
         >
            <!-- property used by BatchManagerImpl, set 'true' if the used JDBC driver
             supports proper "int[] Statement.executeBatch()" return result arrays (many
             driver simply return 'success' instead the number of modified rows)-->
            <attribute attribute-name="batch.supportOptimisticLocking" attribute-value="false"/>
        </batch>

        
        <!-- Specify the caching pipe and the used caching implementation -->
        <object-cache class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl"
            strategy="org.apache.ojb.broker.cache.CachingPipeFlatCopyImpl"
            timeout="-1"
        >
            <!-- attributes used by ObjectCacheDefaultImpl -->
            <attribute attribute-name="default.useSoftReference" attribute-value="true"/>
            <attribute attribute-name="default.maxEntry" attribute-value="-1"/>

            <!-- attributes used by ObjectCacheOSCacheImpl -->
            <attribute attribute-name="oscache.flushOnPut" attribute-value="true"/>
            <attribute attribute-name="oscache.cacheCapacity" attribute-value=""/>
            <attribute attribute-name="oscache.cron" attribute-value=""/>

            <!-- attributes used by ObjectCacheJCSImpl -->
            <attribute attribute-name="jcs.maxObjects" attribute-value=""/>
        </object-cache>

        <!-- alternative sequence manager implementations, see "Sequence Manager" guide -->
        <sequence-manager className="memory">
            <!-- The attribute 'seq.perField': If set 'true' it's possible to define per
            field-descriptor sequence manager. This way you can use different sequence
            identifier generation strategies. If set 'false' only the default sequence manager
            defined within the jdbc-connection-descriptor is used and all sequence descriptors defined
            on field-descriptor level are ignored -->
            <attribute attribute-name="seq.perField" attribute-value="false"/>

            <!-- attributes supported by SequenceManagerHighLowImpl,
            SequenceManagerInMemoryImpl, SequenceManagerNextValImpl
            please see "Sequence Manager" guide or/and javadoc of class for more information -->
            <attribute attribute-name="seq.start" attribute-value="200000"/>
            <attribute attribute-name="seq.autoNaming" attribute-value="true"/>

            <!-- attributes supported by SequenceManagerHighLowImpl
            please see "Sequence Manager" guide or/and javadoc of classes for more information -->
            <attribute attribute-name="seq.grabSize" attribute-value="20"/>

            <!-- optional attributes supported by SequenceManagerNextValImpl (support depends
            on the used database), please see "Sequence Manager" guide or/and javadoc of
            classes for more information -->
            <!-- attribute attribute-name="seq.as" attribute-value="INTEGER"/ -->
            <!-- attribute attribute-name="seq.incrementBy" attribute-value="1"/ -->
            <!-- attribute attribute-name="seq.maxValue" attribute-value="999999999999999999999999999"/ -->
            <!-- attribute attribute-name="seq.minValue" attribute-value="1"/ -->
            <!-- attribute attribute-name="seq.cycle" attribute-value="false"/ -->
            <!-- attribute attribute-name="seq.cache" attribute-value="20"/ -->
            <!-- attribute attribute-name="seq.order" attribute-value="false"/ -->

            <!-- optional attributes supported by SequenceManagerIdentityImpl, more details
            please see "Sequence Manager" guide or/and javadoc of classes for more information -->
            <!-- If set 'true' OJB use the JDBC 3.0 method "Statement.getGeneratedKeys()"
            to obtain generated database identity keys. If set 'false' OJB use a separate
            database specific "last identity call" query to request the generated identity key. -->
            <attribute attribute-name="seq.generatedKeys" attribute-value="true"/>

        </sequence-manager>
   </jdbc-connection-descriptor>

   <!-- Datasource example -->
    <!-- jdbc-connection-descriptor
        jcd-alias="default"
        default-connection="true"
   		platform="Hsqldb"
   		jdbc-level="2.0"
   		jndi-datasource-name="java:DefaultDS"
   		username="sa"
   		password=""
        batch-mode="false"
        useAutoCommit="0"
        ignoreAutoCommitExceptions="false"
   >
        Add the other elements like connection-factory, batch, object-cache, sequence-manager here.

   </jdbc-connection-descriptor -->

