You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Viktors Rotanovs <vi...@riga.nu> on 2000/09/09 20:18:16 UTC
Re: Connection pool
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 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