cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian P Millett <...@ec-group.com>
Subject Re: Connection pool
Date Tue, 11 Jul 2000 21:38:38 GMT
"Pedro E. Gómez" wrote:

> I download and install cocoon 1.7.5-dev,
>
> How can I work with the connection pool? There are some documentation?

1)Make sure that you have gotten the latest CVS (7/11/2000 is good).

2)Make sure that you have built the cocoon.jar file from the CVS sources.

3)Put the turbine-pool.jar file (in the SRC/lib/ directory) where the xalan, xerces, etc.
ar files are located.

4)Edit the jserv.properties and add the turbine-pool.jar to the wrapper.classpath like:
    wrapper.classpath=/opt/apache/jserv/lib/turbine-pool.jar

5)Make sure that the cocoon.properties has something like the following:

####
# TurbineResources parameters go here
#
# Classes for Turbine Services should be defined here.
# Format: services.[name].classname
processor.xsp.pool.services.TurbineResourceService.classname=org.apache.turbine.services.resources.TurbineResourceService
# These are your database settings, look in the
# org.apache.turbine.util.db.pool.* packages for more information.
#### ORACLE
processor.xsp.pool.database.defaultdriver=oracle.jdbc.driver.OracleDriver
processor.xsp.pool.database.default.url=jdbc:oracle:thin:@dolphin:1521:dldf
processor.xsp.pool.database.default.username=dbUser
processor.xsp.pool.database.default.password=dbPass
# The number of database connections to cache in the ConnectionPool.
processor.xsp.pool.database.default.maxConnections=3
# The time in milliseconds that database connections will be cached.
# Default: one hour
processor.xsp.pool.database.helpdesk.expiryTime=3600000
# These are the supported jdbc-drivers and their adaptors.
# These properties are used by the DBFactory.
processor.xsp.pool.database.adaptor=DBWeblogic,DBOracle,DBInstantDB,DBPostgres,DBSybase,DBInformix
processor.xsp.pool.database.adaptor.DBWeblogic=weblogic.jdbc.pool.Driver
processor.xsp.pool.database.adaptor.DBOracle=oracle.jdbc.driver.OracleDriver
processor.xsp.pool.database.adaptor.DBInstantDB=org.enhydra.instantdb.jdbc.idbDriver
processor.xsp.pool.database.adaptor.DBPostgres=postgresql.Driver
processor.xsp.pool.database.adaptor.DBInformix=com.informix.jdbc.IfxDriver
processor.xsp.pool.database.adaptor.DBSybase=com.sybase.jdbc.SybDriver
# The full path name to a pool log file
# if not given, commands to log events using org.apache.turbine.util.Log will be ignored.
# This file must already exist and be writable.
# Default: none
#
processor.xsp.pool.logfile=/opt/apache/var/log/dbPool.log



You can add any connection definition such as:
#### INFORMIX TROPICOS
processor.xsp.pool.database.tropicos.driver=com.informix.jdbc.IfxDriver
processor.xsp.pool.database.tropicos.url=jdbc:informix-sqli://localhost:1526/database:informixserver=serverName
processor.xsp.pool.database.tropicos.username=dbUser
processor.xsp.pool.database.tropicos.password=dbPass
# The number of database connections to cache in the ConnectionPool.
processor.xsp.pool.database.tropicos.maxConnections=3
# The time in milliseconds that database connections will be cached.
# Default: one hour
processor.xsp.pool.database.tropicos.expiryTime=3600000

6) Use the connection pool in a xml file.  Example:

<?xml version="1.0"?>

<?cocoon-process type="xsp"?>

<?cocoon-process type="xslt"?>
<?xml-stylesheet href="rowset.page.xhtml.xsl" type="text/xsl"?>

<xsp:page
  language="java"
  xmlns:sql="http://www.apache.org/1999/SQL"
  xmlns:request="http://www.apache.org/1999/XSP/Request"
  xmlns:util="http://www.apache.org/1999/XSP/Util"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:context="http://www.apache.org/1999/XSP/Context"
>

<page>
 <title>First XSPSQL Page</title>
 <author>
  <name>Brian Millett</name>
  <address>bpm@ec-group.com</address>
 </author>

 <p>Hi, I'm your first XSP SQL page ever.</p>

 <p>I've been requested <util:counter/> times.</p>

 <context:log message="This is a test of the context Log test"/>

 <sql:execute-query>
   <sql:use-connection>helpdesk</sql:use-connection>
   <sql:skip-rows>0</sql:skip-rows>
   <sql:max-rows>50</sql:max-rows>
   <sql:null-indicator>y</sql:null-indicator>
   <sql:count-attribute>BOB</sql:count-attribute>
   <sql:doc-element>ROWSET</sql:doc-element>
   <sql:row-element>ROW</sql:row-element>
   <sql:tag-case>preserve</sql:tag-case>
   <sql:id-attribute>ID</sql:id-attribute>
   <sql:query>
SELECT last_name, first_name, initials
FROM EMPLOYEE
   </sql:query>
 </sql:execute-query>

 <sql:execute-query>
   <sql:use-connection>tropicos</sql:use-connection>
   <sql:skip-rows>0</sql:skip-rows>
   <sql:count-attribute></sql:count-attribute>
   <sql:max-rows>50</sql:max-rows>
   <sql:tag-case>preserve</sql:tag-case>
   <sql:doc-element>ROWSET</sql:doc-element>
   <sql:row-element>ROW</sql:row-element>
   <sql:null-indicator>omit</sql:null-indicator>
   <sql:id-attribute>ID</sql:id-attribute>
   <sql:query>
SELECT   family_id,family_name
FROM     families
   </sql:query>
 </sql:execute-query>
 </page>
</xsp:page>

Así lo hace.

--
Brian Millett
Enterprise Consulting Group   "Shifts in paradigms
(314) 205-9030               often cause nose bleeds."
bpm@ec-group.com                           Greg Glenn




Mime
View raw message