You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Peter Bowman <pe...@hotmail.com> on 2006/04/11 01:05:09 UTC

Derby Trigger Problem

Hi All,

This is the exact trigger I am trying to create:

CREATE TRIGGER TEST AFTER INSERT ON PLAN_NAME_TABLE REFERENCING NEW AS 
NEWROW FOR EACH ROW MODE DB2SQL INSERT INTO PLAN_NUTRIENT_TABLE (PLAN, 
NUTRIENT, NUTRIENT_TYPE, UNITS) VALUES (NEWROW.PLAN, 'Total Fat', 'Fat', 
'g'),(NEWROW.PLAN, 'Total Protein', 'Protein', 'g');

The database contains no Clobs/Blobs (if that's the correct term for them, 
I'm new to this) nor it is very large, just 9 tables with only a bit of data 
in them since I am just starting to test my application.

Another thing I have noticed. If I start a fresh connection and then try to 
create this trigger the first time I get a StringIndexOutOfBoundsException 
-8, only the next time do I get the RawStore module problem.

Peter.



Re: Derby Trigger Problem

Posted by Daniel John Debrunner <dj...@apache.org>.
Peter Bowman wrote:

> Hi All,
> 
> First of all, thanks for your responses. Here is the stack trace, I
> think its what you requested.


Thanks, I managed to reproduce your problem and entered this bug.

http://issues.apache.org/jira/browse/DERBY-1204

Dan.



Re: Derby Trigger Problem

Posted by Peter Bowman <pe...@hotmail.com>.
Hi All,

First of all, thanks for your responses. Here is the stack trace, I think 
its what you requested.

-----------------------------------------------------------------------------------------------------------------

java.lang.StringIndexOutOfBoundsException: String index out of range: -8
        at java.lang.String.substring(String.java:1768)
        at 
org.apache.derby.impl.sql.compile.CreateTriggerNode.bindReferencesClause(Unknown 
Source)
        at org.apache.derby.impl.sql.compile.CreateTriggerNode.bind(Unknown 
Source)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown 
Source)
        at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown 
Source)
        at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at com.dbuddies.nutritab.OpeningFrame.<init>(OpeningFrame.java:330)
        at com.dbuddies.nutritab.OpeningFrame$18.run(OpeningFrame.java:2370)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
        at 
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
        at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at 
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at 
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

-----------------------------------------------------------------------------------------------------------------

if you need other info just ask. I may not be able to get it though cause 
I'm just a hobbyist and am  not that sure of what I'm doing.

Peter.

>From: Daniel John Debrunner <dj...@apache.org>
>Reply-To: "Derby Discussion" <de...@db.apache.org>
>To: Derby Discussion <de...@db.apache.org>
>Subject: Re: Derby Trigger Problem
>Date: Tue, 11 Apr 2006 07:11:12 -0700
>
>Stanley Bradbury wrote:
>
> > Peter Bowman wrote:
> >
> >> Hi All,
> >>
> >> This is the exact trigger I am trying to create:
> >>
> >> CREATE TRIGGER TEST AFTER INSERT ON PLAN_NAME_TABLE REFERENCING NEW AS
> >> NEWROW FOR EACH ROW MODE DB2SQL INSERT INTO PLAN_NUTRIENT_TABLE (PLAN,
> >> NUTRIENT, NUTRIENT_TYPE, UNITS) VALUES (NEWROW.PLAN, 'Total Fat',
> >> 'Fat', 'g'),(NEWROW.PLAN, 'Total Protein', 'Protein', 'g');
> >>
> >> The database contains no Clobs/Blobs (if that's the correct term for
> >> them, I'm new to this) nor it is very large, just 9 tables with only a
> >> bit of data in them since I am just starting to test my application.
> >>
> >> Another thing I have noticed. If I start a fresh connection and then
> >> try to create this trigger the first time I get a
> >> StringIndexOutOfBoundsException -8, only the next time do I get the
> >> RawStore module problem.
> >>
> >> Peter.
> >>
> >>
> >>
> > Hi Peter -
> > Will need some additional information to be of assistance.  You mention
> > a RawStore problem, these are often caused by JVM, Disk or I/O problems
> > (and, of course, the occasional bug) but without the specific error and
> > stack trace there is no way to know.
>
>The RawStore issue is just a side effect of the original exception, the
>StringIndexOutOfBoundsException. The RawStore exception is caused by
>incorrect cleanup in the code, the original error is the one of interest.
>
>As Stan says, the stack trace for the StringIndexOutOfBoundsException
>would be very useful.
>
>Dan.
>
>



Re: Derby Trigger Problem

Posted by Daniel John Debrunner <dj...@apache.org>.
Stanley Bradbury wrote:

> Peter Bowman wrote:
> 
>> Hi All,
>>
>> This is the exact trigger I am trying to create:
>>
>> CREATE TRIGGER TEST AFTER INSERT ON PLAN_NAME_TABLE REFERENCING NEW AS
>> NEWROW FOR EACH ROW MODE DB2SQL INSERT INTO PLAN_NUTRIENT_TABLE (PLAN,
>> NUTRIENT, NUTRIENT_TYPE, UNITS) VALUES (NEWROW.PLAN, 'Total Fat',
>> 'Fat', 'g'),(NEWROW.PLAN, 'Total Protein', 'Protein', 'g');
>>
>> The database contains no Clobs/Blobs (if that's the correct term for
>> them, I'm new to this) nor it is very large, just 9 tables with only a
>> bit of data in them since I am just starting to test my application.
>>
>> Another thing I have noticed. If I start a fresh connection and then
>> try to create this trigger the first time I get a
>> StringIndexOutOfBoundsException -8, only the next time do I get the
>> RawStore module problem.
>>
>> Peter.
>>
>>
>>
> Hi Peter -
> Will need some additional information to be of assistance.  You mention
> a RawStore problem, these are often caused by JVM, Disk or I/O problems
> (and, of course, the occasional bug) but without the specific error and
> stack trace there is no way to know.

The RawStore issue is just a side effect of the original exception, the
StringIndexOutOfBoundsException. The RawStore exception is caused by
incorrect cleanup in the code, the original error is the one of interest.

As Stan says, the stack trace for the StringIndexOutOfBoundsException
would be very useful.

Dan.



Re: Derby Trigger Problem

Posted by Stanley Bradbury <St...@gmail.com>.
Peter Bowman wrote:

> Hi All,
>
> This is the exact trigger I am trying to create:
>
> CREATE TRIGGER TEST AFTER INSERT ON PLAN_NAME_TABLE REFERENCING NEW AS 
> NEWROW FOR EACH ROW MODE DB2SQL INSERT INTO PLAN_NUTRIENT_TABLE (PLAN, 
> NUTRIENT, NUTRIENT_TYPE, UNITS) VALUES (NEWROW.PLAN, 'Total Fat', 
> 'Fat', 'g'),(NEWROW.PLAN, 'Total Protein', 'Protein', 'g');
>
> The database contains no Clobs/Blobs (if that's the correct term for 
> them, I'm new to this) nor it is very large, just 9 tables with only a 
> bit of data in them since I am just starting to test my application.
>
> Another thing I have noticed. If I start a fresh connection and then 
> try to create this trigger the first time I get a 
> StringIndexOutOfBoundsException -8, only the next time do I get the 
> RawStore module problem.
>
> Peter.
>
>
>
Hi Peter -
Will need some additional information to be of assistance.  You mention 
a RawStore problem, these are often caused by JVM, Disk or I/O problems 
(and, of course, the occasional bug) but without the specific error and 
stack trace there is no way to know.
Please post the exceptions with the the stack trace recorded in the 
derby.log file.  In addition knowing the schema of both tables 
involved.would expedite things.  Lastly, the output from SYSINFO is 
important to understanding the versions of all the components involved.