You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Pedro E. Gómez" <pg...@pragma.com.co> on 2000/07/11 18:03:07 UTC

Connection pool

I download and install cocoon 1.7.5-dev, 

How can I work with the connection pool? There are some documentation?

When is going to be released the 1.7.5 version?



Esta buscando administrar y publicar banners eficientemente? Visitehttp://www.pragma.com.co/sitio/soluciones/productos.htmlPedro Enrique Gómez de los RiosProject Engineer / Ingeniero de Proyectos. PRAGMA: Now is Time to Get Value. http://www.pragma.com.co

______________________________________
Message sent with Misiva.
Visit us at http://www.pragma.com.co/misiva

Re: Connection pool

Posted by Viktors Rotanovs <vi...@riga.nu>.
Hi,

I solved the question I asked like this:

DBConnection db = DBBroker.getInstance().getConnection("connection-name");
Statement statement = db.createStatement();
ResultSet rs = statement.executeQuery("some sql query"));
...
rs.close();
statement.close();
DBBroker.getInstance().releaseConnection(db);

Did I miss something? What will happen if user will press Stop button
after connection is allocated from the pool, but before it's released?

On Sat, 09 Sep 2000, you wrote:
> Hi,
>
> just one more question on the same topic:
> what is the correct syntax for calling pool code from xsp page logic?
> Is there something shorter than tons of java code in esql.xsl?
>
> On Tue, 11 Jul 2000, you wrote:
> > "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.t
> >ur bine.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:dl
> >df 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,DBPos
> >tg res,DBSybase,DBInformix
> > processor.xsp.pool.database.adaptor.DBWeblogic=weblogic.jdbc.pool.Driver
> > processor.xsp.pool.database.adaptor.DBOracle=oracle.jdbc.driver.OracleDri
> >ve r
> > processor.xsp.pool.database.adaptor.DBInstantDB=org.enhydra.instantdb.jdb
> >c. idbDriver
> > processor.xsp.pool.database.adaptor.DBPostgres=postgresql.Driver
> > processor.xsp.pool.database.adaptor.DBInformix=com.informix.jdbc.IfxDrive
> >r 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:1
> >52 6/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.

-- 
Best Wishes,
Viktors Rotanovs
I create websites that attract more clients. http://riga.nu/
Riga Latvia +371, Phone 7377-142, GSM 9173-000, FAX 7377-472

Re: Connection pool

Posted by Viktors Rotanovs <vi...@riga.nu>.
Hi,

just one more question on the same topic:
what is the correct syntax for calling pool code from xsp page logic?
Is there something shorter than tons of java code in esql.xsl?

On Tue, 11 Jul 2000, you wrote:
> "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.tur
>bine.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,DBPostg
>res,DBSybase,DBInformix
> processor.xsp.pool.database.adaptor.DBWeblogic=weblogic.jdbc.pool.Driver
> processor.xsp.pool.database.adaptor.DBOracle=oracle.jdbc.driver.OracleDrive
>r
> 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:152
>6/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.

-- 
Best Wishes,
Viktors Rotanovs
I create websites that attract more clients. http://riga.nu/
Riga Latvia +371, Phone 7377-142, GSM 9173-000, FAX 7377-472

Re: Connection pool

Posted by Uli Mayring <ul...@denic.de>.
On Tue, 11 Jul 2000 bpm@carrier.ec-group.com wrote:

> processor.xsp.pool.database.default.username=dbUser
> processor.xsp.pool.database.default.password=dbPass

You know, I wrote my own authentication and session handling and was so
glad that I finally got rid of storing username and password in some XML
file and now you put it back in ;-)

Seriously, this is just a default setting and can be overridden, right?

Ulrich


Re: Connection pool

Posted by Brian P Millett <bp...@ec-group.com>.
"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