cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <h...@dvs1.informatik.tu-darmstadt.de>
Subject Re: cocoon userdocs/xsp/esql.html
Date Wed, 06 Feb 2002 08:38:42 GMT
On 05.Feb.2002 -- 11:34 PM, Conrad Wood wrote:
> you refer to a database connection
> 'ConnectionName' in the Example and a
> note 'ConnectionName' is defined is
> cocoon.xconf.
> I spent the last day trying to figure out how
> to add this to cocoon.xconf. Can you add a link
> to how to do this on the sample-page?

Conrad, have a close look at the sample cocoon.xconf. There's one
database connection defined as "personnel":

  <!-- Datasources:
  -->
  <datasources>
    <jdbc name="personnel" logger="core.datasources.personnel">
      <!--
          If you have an Oracle database, and are using the the
      pool-controller below, you should add the attribute
      "oradb" and set it to true.

      <pool-controller min="5" max="10" oradb="true"/>

      That way the test to see if the server has disconnected
      the JdbcConnection will function properly.
      -->
      <pool-controller min="5" max="10"/>
      <!--
          If you need to ensure an autocommit is set to true or
      false, then create the "auto-commit" element below.

      <auto-commit>false</auto-commit>

      The default is true.
      -->
      <dburl>jdbc:hsqldb:hsql://localhost:9002</dburl>
      <user>sa</user>
      <password></password>
    </jdbc>
  </datasources>

I believe the semantics of this should be pretty obvious (to someone
familiar with jdbc, but esql doesn't free you from that). To define a
new database connection, add another <jdbc/> block.

If for some reason you don't want to use these connection pools, you
may as well specify on your xsp:

    	 <esql:connection>   	    
<!--
	Pool not used:
	 <esql:pool>personnel</esql:pool>
-->
   	<esql:dburl>jdbc:hsqldb:hsql://localhost:9002</esql:dburl>
   	<esql:username>sa</esql:username>
   	<esql:password></esql:password>

	 <esql:execute-query>
   	       <esql:query><xsp:expr>thequery</xsp:expr></esql:query>
   	       <esql:results>
   	          <esql:row-results>
		       <esql:get-columns/>
		  </esql:row-results>
   	       </esql:results>
   	       <esql:error-results>
   	          <error><esql:get-message/></error>
   	       </esql:error-results>
   	    </esql:execute-query>
	    </esql:connection>

HTH

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message