Re: Errors in triggers and Connection disconnected
Re: Errors in triggers and Connection disconnected
- Subject: Re: Errors in triggers and Connection disconnected
- From: email@hidden
- Date: Wed, 22 Dec 2004 11:44:24 +0100
hiya,
I am not sure weather you really understand what Trigger does!
Trigger executes when update a ROW and not when you change the owner of a
TABLE!!
back to the DB handbook.
----- Original Message -----
From: "Damien Lust" <email@hidden>
To: "WOdev List" <email@hidden>;
<email@hidden>
Sent: Wednesday, December 22, 2004 9:31 AM
Subject: Errors in triggers and Connection disconnected
> I have a table QUERY and a trigger on it:
>
> pseudo-code of my trigger :
>
>
> CREATE OR REPLACE TRIGGER Q_UPDATE
> BEFORE UPDATE ON QUERY
> FOR EACH ROW
>
> BEGIN
>
> IF !correctConnection then
> raise_application_error(-20000, 'Action aborted: work session is not
> active!');
>
> IF :new.OWNER_PROFILE != :old.OWNER_PROFILE then
> raise_application_error(-20011, 'Action aborted: you can''t
> modify the owner!');
> END IF;
>
> END;
>
> 2 errors can happen - if the connection is not correct ( a stored
> procedure to identify the user must be apply to the
> connection(editingContext) before use of it )
> - if the user modify the owner
>
>
> In my case , i product an error by modifying the owner (the connection
> is correct), I want to retrieve the error message 'Action aborted: you
> can''t modify the owner!' and display it to the user
>
>
>
> Java code :
>
> ...
> String sql = "UPDATE QUERY SET OWNER_PROFILE='TFA' WHERE KEY = 667" //
> Created dynamically
>
> ....
> try {
> EOUtilities.rawRowsForSQL(editingContext(), "DLQTModel", sql, null);
> }catch(Exception e) {
>
> throw new KeopsException( " Impossible to execute request : " + sql,
> e);
> }
>
>
> Here you the WO logs and my comments
>
> [2004-12-21 18:45:28 CET] <WorkerThread0> === Begin Internal
> Transaction
> [2004-12-21 18:45:28 CET] <WorkerThread0> evaluateExpression:
> <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "UPDATE
> QUERY SET OWNER_PROFILE='TFA' WHERE KEY = 667">
> [2004-12-21 18:45:28 CET] <WorkerThread0> === Rollback Internal
> Transaction
>
> => a rollback , it seems that there is a anormal thing, but no error
> message
>
> [2004-12-21 18:45:28 CET] <WorkerThread0> connection disconnected.
> [2004-12-21 18:45:28 CET] <WorkerThread0> connection disconnected.
>
> => 2 connections disconnected... why 2?
>
> [2004-12-21 18:45:28 CET] <WorkerThread0> connecting with dictionary:
> {password = "<password deleted for log>"; username = "CLIENT"; URL =
> "jdbc:Oracle:thin:
> @(description=(address_list=(address=(protocol=tcp)(host=192.168.169.10)
> (port=1521)))(connect_data=(SERVER=DEDICATED)(SERVICE_NAME=KEOPSTST)))";
> }
> [2004-12-21 18:45:28 CET] <WorkerThread0> === Begin Internal
> Transaction
> [2004-12-21 18:45:28 CET] <WorkerThread0> evaluateExpression:
> <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "UPDATE
> QUERY OWNER_PROFILE='TFA' WHERE KEY = 667">
> [2004-12-21 18:45:28 CET] <WorkerThread0> === Rollback Internal
> Transaction
>
> => Try to recreate a connection and reexecute the request (but the
> connection is not correct: no stored procedure called to validate the
> session of the user) . I don't understand why it try to create a new
> connection and reexecute request
>
>
>
> [2004-12-21 18:45:29 CET] <WorkerThread0> <DLQTDA>: Exception in
> performActionNamed() on the action "queryDefinition" with the message:
> KeopsException: Impossible to execute request : UPDATE
> KEOPS_INTERNAL.QUERY SET OWNER_PROFILE='TFA' WHERE KEY = 667
> [2004-12-21 18:45:28 CET] <WorkerThread0> KeopsException: null
> Impossible to execute request : UPDATE QUERY SET OWNER_PROFILE='TFA'
> WHERE KEY = 667
>
> => an error , because my connection is not correct (first error in the
> trigger) , but it's not the first cause of error....
>
> at DLQTSQuery.updateSql(DLQTSQuery.java:965)
> at DLQTSQuery.save(DLQTSQuery.java:1030)
> at DLQTSQuery.insertObject(DLQTSQuery.java:928)
> at DLQTDA.newQueryID(DLQTDA.java:1865)
> at DLQTDA.queryDefinitionAction(DLQTDA.java:440)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
> com.webobjects.appserver.WODirectAction.performActionNamed(WODirectActio
> n.java:128)
> at WDLDirectAction.performActionNamed(WDLDirectAction.java:63)
> at
> com.webobjects.appserver._private.WOActionRequestHandler._handleRequest(
> WOActionRequestHandler.java:240)
> at
> com.webobjects.appserver._private.WOActionRequestHandler.handleRequest(W
> OActionRequestHandler.java:145)
> at
> com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.jav
> a:1308)
> at
> com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.
> java:173)
> at
> com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java
> :254)
> at java.lang.Thread.run(Thread.java:552)
> Caused by: com.webobjects.jdbcadaptor.JDBCAdaptorException:
> EvaluateExpression failed:
> <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "UPDATE
> QUERY SET OWNER_PROFILE='TFA' WHERE KEY = 664">:
> Next exception:SQL State:72000 -- error code: 20000 -- msg:
> ORA-20000: Action aborted: work session is not active!
>
> => the error message is displayed, but as said before it's not the
> first cause of error....
>
> ORA-06512: at "KEOPS_INTERNAL.PK_ACCESS_CONTROL", line 32
> ORA-06512: at "KEOPS_INTERNAL.Q_UPDATE", line 3
> ORA-04088: error during execution of trigger 'KEOPS_INTERNAL.Q_UPDATE'
>
> at
> com.webobjects.jdbcadaptor.JDBCContext._jdbcErrorWithChannel(JDBCContext
> .java:138)
> at
> com.webobjects.jdbcadaptor.JDBCChannel._evaluateExpression(JDBCChannel.j
> ava:304)
> at
> com.webobjects.jdbcadaptor.JDBCChannel.evaluateExpression(JDBCChannel.ja
> va:255)
> at
> com.webobjects.eoaccess.EOUtilities._rawRowsForSQL(EOUtilities.java:
> 584)
> at
> com.webobjects.eoaccess.EOUtilities.rawRowsForSQL(EOUtilities.java:559)
> at DLQTSQuery.updateSql(DLQTSQuery.java:959)
> ... 16 more
>
>
>
> main questions :
>
> - why it doesn't crash after the first error and doesn't display the
> first error?
> - Why rollback and 2 connections disconnected for the first error?
> - why it try to reconnect after first error? is it possible to avoid
> this?
>
>
> Thanks a lot.
>
> _______________________________________________
> WebObjects-dev mailing list
> email@hidden
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden