By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,536 Members | 1,504 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,536 IT Pros & Developers. It's quick & easy.

Error SQLCODE "-811", SQLSTATE "21000"

P: n/a
Our web programmer was looking in his application log an found the
following error:

2006-08-31 16:33:35,129 ERROR org.hibernate.util.JDBCExceptionReporter
- <[IBM][CLI Driver][DB2/6000] SQL0723N An error occurred in a
triggered SQL statement in trigger "OLGCWEB.TBLPROPS_INS_TRG".
Information returned for the error includes SQLCODE "-811", SQLSTATE
"21000" and message tokens "". SQLSTATE=09000
(JDBCExceptionReporter.java.logExceptions:72)
2006-08-31 16:33:35,139 ERROR
org.hibernate.event.def.AbstractFlushingEventListe ner - <Could not
synchronize database state with session>
(AbstractFlushingEventListener.java.performExecuti ons:277)
org.hibernate.exception.GenericJDBCException: could not insert:
[ca.olgc.proline.domain.PropDO]
at
org.hibernate.exception.SQLStateConverter.handledN onSpecificException(SQLStateConverter.java:82)
at
org.hibernate.exception.SQLStateConverter.convert( SQLStateConverter.java:70)
at
org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:43)
at
org.hibernate.persister.entity.BasicEntityPersiste r.insert(BasicEntityPersister.java:1869)
at
org.hibernate.persister.entity.BasicEntityPersiste r.insert(BasicEntityPersister.java:2200)
at
org.hibernate.action.EntityInsertAction.execute(En tityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.execute(ActionQue ue.java:239)
at
org.hibernate.engine.ActionQueue.executeActions(Ac tionQueue.java:223)
at
org.hibernate.engine.ActionQueue.executeActions(Ac tionQueue.java:136)
at
org.hibernate.event.def.AbstractFlushingEventListe ner.performExecutions(AbstractFlushingEventListene r.java:274)
at
org.hibernate.event.def.DefaultFlushEventListener. onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.j ava:730)
at
ca.olgc.proline.dao.hibernate.BaseHibernateDAO.bat chSaveOrUpdate(BaseHibernateDAO.java(Compiled
Code))
at
ca.olgc.proline.facade.sessionbeans.PropicksCardBe an.addOrUpdateProPicksCard(PropicksCardBean.java:2 33)
at
ca.olgc.proline.facade.sessionbeans.EJSLocalStatel essPropicksCard_464a659b.addOrUpdateProPicksCard(E JSLocalStatelessPropicksCard_464a659b.java:159)
at
ca.olgc.proline.facade.ProlineFacadeBean.addOrUpda teProPicksCard(ProlineFacadeBean.java:780)
at
ca.olgc.proline.facade.EJSRemoteStatelessProlineFa cade_cc482172.addOrUpdateProPicksCard(EJSRemoteSta telessProlineFacade_cc482172.java:567)
at
ca.olgc.proline.facade._ProlineFacade_Stub.addOrUp dateProPicksCard(_ProlineFacade_Stub.java:1579)
at
ca.olgc.proline.messaging.helper.DatabaseUpdateHel per.add(DatabaseUpdateHelper.java:106)
at
ca.olgc.proline.messaging.helper.DatabaseUpdateHel per.updateDB(DatabaseUpdateHelper.java:50)
at
ca.olgc.proline.messaging.mdb.SportsRefresherBean. updateDB(SportsRefresherBean.java:81)
at
ca.olgc.proline.messaging.mdb.SportsRefresherBean. onMessage(SportsRefresherBean.java:65)
at
com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnM essage.run(MDBWrapper.java:208)
at java.security.AccessController.doPrivileged(Native Method)
at
com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage( MDBWrapper.java:197)
at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBW rapper.java:175)
at com.ibm.mq.jms.MQSession.run(MQSession.java(Compil ed Code))
at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHan dle.java:923)
at
com.ibm.ejs.jms.listener.ServerSession.connectionC onsumerOnMessage(ServerSession.java:739)
at
com.ibm.ejs.jms.listener.ServerSession.onMessage(S erverSession.java:524)
at
com.ibm.ejs.jms.listener.ServerSession.dispatch(Se rverSession.java:491)
at java.lang.reflect.Method.invoke(Native Method)
at
com.ibm.ejs.jms.listener.ServerSessionDispatcher.d ispatch(ServerSessionDispatcher.java:37)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrap per.java:91)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrap per.java:127)
at com.ibm.ejs.jms.listener.ServerSession.run(ServerS ession.java:373)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:681)
Caused by:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/6000] SQL0723N An
error occurred in a triggered SQL statement in trigger
"OLGCWEB.TBLPROPS_INS_TRG". Information returned for the error
includes SQLCODE "-811", SQLSTATE "21000" and message tokens "".
SQLSTATE=09000
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_S QLException(SQLExceptionGenerator.java(Compiled
Code))
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_S QLException(SQLExceptionGenerator.java(Inlined
Compiled Code))
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_r eturn_code(SQLExceptionGenerator.java(Compiled
Code))
at
COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2 (DB2PreparedStatement.java(Compiled
Code))
at
COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeU pdate(DB2PreparedStatement.java:1642)
at
com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement. executeUpdate(WSJdbcPreparedStatement.java:462)
at
org.hibernate.jdbc.NonBatchingBatcher.addToBatch(N onBatchingBatcher.java:22)
at
org.hibernate.persister.entity.BasicEntityPersiste r.insert(BasicEntityPersister.java:1853)
... 33 more
2006-08-31 16:33:35,156 ERROR ca.olgc.proline.dao.hibernate.CardDAOImpl
- <Exception encountered in saveOrUpdate()(?.java:?)

I'm not sure what this is telling me. The Db2 Administration Guide
says:

sqlcode: -811

sqlstate: 21000

SQL0817N The SQL statement cannot be executed because the statement
will result in a prohibited update operation.
Explanation: The application attempted to execute an SQL statement that
would result in updates to user data or to the subsystem catalog. This
is prohibited for one of the following reasons:

The application is running as an IMS inquiry-only transaction.
The application is an IMS or CICS application that is attempting to
update data at a remote DBMS that does not support two-phase commit.
The application is attempting to update data at multiple locations and
one of the locations does not support two-phase commit.
These SQL statements include INSERT, UPDATE, DELETE, CREATE, ALTER,
DROP, GRANT, and REVOKE.

The statement cannot be executed.

User Response: If the application is running as an IMS inquiry-only
transaction, see your IMS system programmer about changing the
inquiry-only status of the transaction under which your application is
running.

If the IMS or CICS application is attempting a remote update, either
the application must be changed to run as a local application on the
server DBMS, or the server DBMS must be upgraded to support two-phase
commit.

If the application is attempting to update data at multiple locations,
either the application must be changed, or all DBMSs involved must be
upgraded to support two-phase commit.
There's only one database involved, Here's the SQL from the trigger:

CREATE TRIGGER TBLPROPS_ins_trg
NO CASCADE
BEFORE INSERT ON TBLPROPS REFERENCING NEW AS T1 FOR EACH ROW
MODE DB2SQL
SET T1.PROD_GROUP_TYPE_CODE = 'LOTPRPICKS',
T1.PARTICIPANT_DESC = (SELECT TEAM_NAME FROM TBLCARDS T2,
TBLTEAMNAMES T3
WHERE T3.TEAM_ABBR = T1.PARTICIPANT and
T3.SPORT_ID = T2.SPORT_ID and
T2.CARD_ID = T1.CARD_ID and
T2.LIST_NUMBER = T1.LIST_NUMBER)

Any help greatly appreciated. DB2 UDB 7.2.

Richard

Sep 1 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Richard wrote:
Our web programmer was looking in his application log an found the
following error:

2006-08-31 16:33:35,129 ERROR org.hibernate.util.JDBCExceptionReporter
- <[IBM][CLI Driver][DB2/6000] SQL0723N An error occurred in a
triggered SQL statement in trigger "OLGCWEB.TBLPROPS_INS_TRG".
Information returned for the error includes SQLCODE "-811", SQLSTATE
"21000" and message tokens "". SQLSTATE=09000
>(JDBCExceptionReporter.java.logExceptions:72)
2006-08-31 16:33:35,139 ERROR
org.hibernate.event.def.AbstractFlushingEventListe ner - <Could not
synchronize database state with session>
(AbstractFlushingEventListener.java.performExecuti ons:277)
org.hibernate.exception.GenericJDBCException: could not insert:
[ca.olgc.proline.domain.PropDO]
at
[...]

I'm not sure what this is telling me. The Db2 Administration Guide
says:

sqlcode: -811

sqlstate: 21000

SQL0817N The SQL statement cannot be executed because the statement
will result in a prohibited update operation.
$ db2 "? sql0811"

SQL0811N The result of a scalar fullselect, SELECT INTO
statement, or VALUES INTO statement is more than one
row.
There's only one database involved, Here's the SQL from the trigger:

CREATE TRIGGER TBLPROPS_ins_trg
NO CASCADE
BEFORE INSERT ON TBLPROPS REFERENCING NEW AS T1 FOR EACH ROW
MODE DB2SQL
SET T1.PROD_GROUP_TYPE_CODE = 'LOTPRPICKS',
T1.PARTICIPANT_DESC = (SELECT TEAM_NAME FROM TBLCARDS T2,
TBLTEAMNAMES T3
WHERE T3.TEAM_ABBR = T1.PARTICIPANT and
T3.SPORT_ID = T2.SPORT_ID and
T2.CARD_ID = T1.CARD_ID and
T2.LIST_NUMBER = T1.LIST_NUMBER)
According to the error message, your subselect returns more than one row.
Of course, this cannot be handled safely. If you don't care about which
row to use, then you could apply the FETCH FIRST 1 ROW ONLY clause. If the
row matters, find the correct one.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Sep 1 '06 #2

P: n/a
Thanks. :-)

Sep 1 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.