alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Commons DBCP example source code file (poolingDriverExample.jocl.sample)

This example Commons DBCP source code file (poolingDriverExample.jocl.sample) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Commons DBCP tags/keywords

asf, change, jocl, jocl, license, license, poolableconnectionfactory, see, see, the, the, to, we'll, you

The Commons DBCP poolingDriverExample.jocl.sample source code

<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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.
-->
<!--
 Sample JOCL configuration file for JOCLPoolingDriverExample.java.

 It's not pretty, but it works.  It will be replaced by Digester-based
 configuration as soon as it's available.

 See the JavaDocs for org.apache.commons.jocl.JOCLContentHandler for
 documentation on JOCL in general. The gist of it is an that it provides
 an XML description of a constructor to be invoked.

 See the JavaDocs for PoolableConnectionFactory et al for details
 on the object we are constructing. The inline comments may help as well.

 To use this with the JOCLPoolingDriverExample, make a copy of this
 file called it "poolingDriverExample.jocl", set the connection string below
 (search for "CHANGE ME"), and make sure the poolingDriverExample.jocl file
 is available in your classpath. (See JOCLPoolingDriverExample.java.)
-->

<!--
   The PoolingDriver expects PoolableConnectionFactory to be the root of the JOCL document.
 -->
<object class="org.apache.commons.dbcp.PoolableConnectionFactory" xmlns="http://apache.org/xml/xmlns/jakarta/commons/jocl">
   <!--
      The first argument to PoolableConnectionFactory is a ConnectionFactory.
      We'll use a DriverManagerConnectionFactory, passing in the appropriate
      connect string for the underlying driver.
    -->
   <object class="org.apache.commons.dbcp.DriverManagerConnectionFactory">
      <string value="jdbc:oracle:thin:scott/tiger@myhost:1521:mysid"/> 
      <object class="java.util.Properties" null="true"/>
   </object>
   <!--
      The next argument is the pool to use.  We'll use a StackObjectPool,
      although any implementation of ObjectPool should suffice.
    -->
   <object class="org.apache.commons.pool.impl.StackObjectPool"/>
   <!--
      The next argument is the KeyedObjectPoolFactory to use to create pools
      for storing PreparedStatements.  This functionality is optional, we'll
      just use null.
    -->
   <object class="org.apache.commons.pool.KeyedObjectPoolFactory" null="true"/>
   <!--
      The next argument is the query to use to validate that a Connection is
      still up and running.  It should return at least one row.
      This functionality is optional. We'll just set it to null.
    -->
   <string null="true"/>
   <!-- The default "read only" value for Connections. -->
   <boolean value="false"/>
   <!-- The default "auto commit" value for Connections. -->
   <boolean value="true"/>
</object>

Other Commons DBCP examples (source code examples)

Here is a short list of links related to this Commons DBCP poolingDriverExample.jocl.sample source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.