Hi Christian!

I have defined resource:

  <!--
     - deleting of existing employee
    -->
  <map:resource name="employee-delete">
   <map:act type="db-delete">
    <map:parameter name="descriptor"
                   value="mekka/resources/employee-db.xml"/>
    <map:redirect-to uri="employees"/>
   </map:act>
   <map:generate type="serverpages" src="docs/employee_retry.xml"/>
   <map:transform src="stylesheets/employee_dbdelete_retry-html.xsl"/>
   <map:serialize/>
  </map:resource>

Table with employees has foreign key to other table so when I try to delete
(DatabaseDeleteAction) any entry using by this resource I have got cocoon
error:

Cocoon 2 - Internal server error
type fatal
message Could not delete record :position = 0
description org.apache.cocoon.ProcessingException: Could not delete record
:position = 0: java.sql.SQLException: ORA-02292: violation of referential
integrity constraints (SCOTT.FK_DEPTNO) - slave record exists
sender org.apache.cocoon.servlet.CocoonServlet
source Cocoon servlet

If I understand Your explanation it is correct construct that should provide
handling db errors. So how to handle this?

During working of website it is possible to occur damages with DBServer. How
to handle this errors? Often it will be connection errors. Or errors
resulting from transaction fails or constraints violations.

Maybe good way to resolve it will be write own Database*Actions provides to
handle this errors? What do You think? (But of course I welcome simplest
method resolving this trouble..)

Regards
Jerzy Kut


----- Original Message -----
From: "Christian Haul" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 12, 2002 9:50 AM
Subject: Re: esql and db-actions error handling


> On 12.Apr.2002 -- 09:18 AM, Jerzy Kut wrote:
> > Hi cocooners!
> > I want to handle errors coming from esql selects and actions operate on
DB.
> > ESQL - I try to do:
> >
> >    <esql:connection>
> >     <esql:pool>mypool</esql:pool>
> >     <esql:execute-query>
> >      <esql:query>
> >       select EMPNO
> >       from EMP
> >      </esql:query>
> >      <esql:results>
> >       <esql:row-results>
> >        <employee>
> >         <id>
> >          <value><esql:get-long column="EMPNO"/></value>
> >         </id>
> >        </employee>
> >       </esql:row-results>
> >      </esql:results>
> >      <esql:no-results>
> >       <employee-lack/>
> >      </esql:no-results>
> >      <esql:error-results>
> >       <employee-error><esql:get-message/></employee-error>
> >      </esql:error-results>
> >     </esql:execute-query>
> >    </esql:connection>
> >
> > and? When i make fail in select e.g. type "SELCET" not "SELECT" i get
> > "Cocoon error" and cocoon error page! I have same when I define not
exist
> > DSN in DB connection at cocoon.xconf.
> > Maybe anybody knows any howto document or the way what to handle this
> > exceptions.
> > I don't handle errors in sitemap.xmap (if it has any importance).
> >
> > And second question: how to handle db error when I would to use
> > Database*Action? Is any method to handle this error in sitemap.xmaps
> > <pipeline> ?
>
> IMHO error-results refers to errors returned by the database
> system. Any setup error would not be catched and lead to a cocoon
> error. As for the SQL syntax error -- errors during execution are not
> handled in error-results (why?) but only exceptions that occur while
> retrieving the results.
>
> Database*Actions will also cause cocoon errors when connectivity is
> broken. Other errors can be handled by nesting sitemap elements inside
> your action for the success branch and those for failure after it. The
> elements nested will only be considered for your pipeline if the
> action signalles success.
>
> HTH.
>
> Chris.
>
> --
> C h r i s t i a n       H a u l
> [EMAIL PROTECTED]
>     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: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>


---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to