Re: Moving from 10.5.3.0 -> 10.12.1.1 SQLNonTransientConnectionException but 10.5.3.0 ->10.7.1.1 is working perfectly exactly same code, 10.5.3.0 -> 10.8.1.2 fails similar

2016-09-27 Thread bruehlicke
Thanx I will see if I can narrow it down.  I do rebuild the entire sets of
Tables and triggers and hence I would be able to make this reproducable. I
will work on making a small test app and see if I can make it fail. The
interesting bit is that the UPDATE works if I paste the SQL statement
directly into the SQL editor in NetBeans - even with the trigger (!) using
the jars after 10.8. Mysterious.


The table involved CURVE_NUMBER and the TRIGGER on those are created as
following when the project starts. (see below).

Just tested:  If I do NOT create the Trigger (shown below) on the Table -
all works fine in 10.12.1.1. So it is for sure related to the Update
Trigger.



s.execute("CREATE TABLE CURVE_DATA_NUMBER (" +
"CURVE_ID BIGINT NOT NULL,"
+
"SEQ_NUM BIGINT NOT NULL," +
"MDEPTH DOUBLE," +
"CVALUE DOUBLE DEFAULT -999.25"
+
")");

s.execute("ALTER TABLE CURVE_DATA_NUMBER ADD CONSTRAINT
CURVE_DATA_NUMBER_CURVE_ID_FK FOREIGN KEY (CURVE_ID) REFERENCES CURVE (ID)
ON DELETE CASCADE");
s.execute("ALTER TABLE CURVE_DATA_NUMBER ADD CONSTRAINT
CURVE_DATA_NUMBER_UN UNIQUE (CURVE_ID, SEQ_NUM)");
// Create Database Index to speed up - we do NOT need an Index
on the CURVE_ID since it already gets one being a Foreign Key
s.execute("CREATE INDEX CURVE_DATA_NUMBER_SEQ_NUM_INDEX on
CURVE_DATA_NUMBER (SEQ_NUM)");
// Add trigger to update CURVE in case curve data is modyfied
which may impact top/bottom attributes
s.execute("CREATE TRIGGER CURVE_DATA_NUMBER_TRIG_UP AFTER
UPDATE OF CURVE_ID, SEQ_NUM, MDEPTH, CVALUE " +
"ON CURVE_DATA_NUMBER REFERENCING OLD AS UPDATEDROW FOR
EACH ROW UPDATE CURVE SET " +
"TOP_DEPTH=(SELECT MIN(MDEPTH) FROM CURVE_DATA_NUMBER
WHERE CURVE_ID=UPDATEDROW.CURVE_ID AND MDEPTH<>-999.25)," +
"BOTTOM_DEPTH=(SELECT MAX(MDEPTH) FROM
CURVE_DATA_NUMBER WHERE CURVE_ID=UPDATEDROW.CURVE_ID AND MDEPTH<>-999.25),"
+
"MINCVAL=(SELECT MIN(CVALUE) FROM CURVE_DATA_NUMBER
WHERE CURVE_ID=UPDATEDROW.CURVE_ID AND CVALUE<>-999.25)," +
"MAXCVAL=(SELECT MAX(CVALUE) FROM CURVE_DATA_NUMBER
WHERE CURVE_ID=UPDATEDROW.CURVE_ID AND CVALUE<>-999.25) " +
"WHERE ID=UPDATEDROW.CURVE_ID");






On Tue, Sep 27, 2016 at 8:47 PM, Bryan Pendleton  wrote:

> java.lang.NullPointerException
>> at 
>> org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTriggerActionString(Unknown
>> Source)
>> at 
>> org.apache.derby.iapi.sql.dictionary.TriggerDescriptor.getActionSPS(Unknown
>> Source)
>>
>
> This definitely looks like it could be DERBY-6726
>
> https://issues.apache.org/jira/browse/DERBY-6726
>
> From the notes in that bug report we were unable to reproduce
> the problem, and the original reporter noted that
>
>  I rebuilt all the tables and triggers and now the problem doesn't
> happen
>
> It would sure be nice to fix this problem, but if we can't reproduce
> it we may need a lot of help from you to try to fix it.
>
> Alternatively, if you have a way to backup your tables, and then drop
> and re-load your data, it seems like the problem may go away?
>
> The fact that you seemed to be able to narrow down the introduction
> of this problem to Derby 10.8 makes me wonder if DERBY-5121 is related?
>
> At the least, it would be nice if you could put some comments into
> DERBY-6726
> and include as much information as you can about the particulars of your
> situation.
>
> thanks,
>
> bryan
>
>


Re: Moving from 10.5.3.0 -> 10.12.1.1 SQLNonTransientConnectionException but 10.5.3.0 ->10.7.1.1 is working perfectly exactly same code, 10.5.3.0 -> 10.8.1.2 fails similar

2016-09-27 Thread Bryan Pendleton

java.lang.NullPointerException
at 
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTriggerActionString(Unknown
 Source)
at 
org.apache.derby.iapi.sql.dictionary.TriggerDescriptor.getActionSPS(Unknown 
Source)


This definitely looks like it could be DERBY-6726

https://issues.apache.org/jira/browse/DERBY-6726

From the notes in that bug report we were unable to reproduce
the problem, and the original reporter noted that

 I rebuilt all the tables and triggers and now the problem doesn't 
happen

It would sure be nice to fix this problem, but if we can't reproduce
it we may need a lot of help from you to try to fix it.

Alternatively, if you have a way to backup your tables, and then drop
and re-load your data, it seems like the problem may go away?

The fact that you seemed to be able to narrow down the introduction
of this problem to Derby 10.8 makes me wonder if DERBY-5121 is related?

At the least, it would be nice if you could put some comments into DERBY-6726
and include as much information as you can about the particulars of your
situation.

thanks,

bryan



Moving from 10.5.3.0 -> 10.12.1.1 SQLNonTransientConnectionException but 10.5.3.0 ->10.7.1.1 is working perfectly exactly same code, 10.5.3.0 -> 10.8.1.2 fails similar

2016-09-27 Thread bruehlicke
Hello Derby friends,

Running now for a long time happy with 10.5.3.0 but thought it was time to
upgrade. Got my app updated to run with 64 bit JDK 1.8.0_102 and working
fine. Now replaced derby.jar and derbytools.jar and got into trouble whith
any release 10.8.1.2 or higher. Using 10.7.1.1 and lower works.

Using Derby in embedded mode. Win 7 64bit within NetBeans RCP app. This is
on a derby database created with the new version, i.e. not any old database
migration issue.  Code which failing is doing something like:


Connection connection = '


...
Statement s = connection.createStatement();
// Creating a dummy update to make a trigger execute updating a parent
after new data inserted with the prepared statements above
s.execute("UPDATE CURVE_DATA_NUMBER SET CURVE_ID=" + curveId + " WHERE
CURVE_ID=" + curveId + " AND SEQ_NUM=1");


The line with s.execute it fails with the stack below with any Derby
release 10.8.1.2 and higher. But works with 10.7.1.1 and lower.



First I thought it was a trigger failing, but that worked fine. Also
executing the UPDATE statement manually (in NetBeans DB editor) works fine
when using the newer jars). I did go back version by version and run the
same code always replacing derby.jar and derbytools.jar (only 2 jars from
derby distribution  in the classpath) and first at version 10.7.1.1 it all
worked again. Going to 10.8.1.2 fails (stack trace also attached below.)

I see from the release notes that 10.8.1.2 had the major upgrade to JDBC
4.1 and Java 7 but nothing obvious for me what should trigger the error.  I
am still investigating but would for sure hear if anyone had similar issues
or any wild ideas where the culprit of this mystery is. Printing the
instances of statement "s" and the connection they show good actual values
of org.apache.derby.impl.jdbc.EmbedConnection and
org.apache.derby.impl.jdbc.EmbedStatement.  I will see if I can make a
small dummy app which encapsulates the error, but as it fails with 10.8.1.2
I have the strong feeling it must be a simple thing which I need to have to
modify to make it work again.


Note the error is slightly different in 10.12.1.1 than all the other
releases (10.11.1.1 to 10.8.1.2). From 10.7.1.1 all is happily working
again.

Regards
Bernd



STACK  when using 10.8.1.2: ( and further down the stack when using
10.12.1.1).


FINEST [com.effi.vin.api.LasReader]: doInBackground: EXECUTING UPDATE OF
CURVE_ID to trigger DB trigger

createStatement failed: java.sql.SQLNonTransientConnectionException: No
current connection.
getRS failed:java.sql.SQLNonTransientConnectionException: No current
connection.
SEVERE [org.openide.util.Exceptions]
java.lang.NullPointerException
at
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTriggerActionString(Unknown
Source)
at
org.apache.derby.iapi.sql.dictionary.TriggerDescriptor.getActionSPS(Unknown
Source)
at
org.apache.derby.impl.sql.execute.GenericTriggerExecutor.getAction(Unknown
Source)
at
org.apache.derby.impl.sql.execute.RowTriggerExecutor.fireTrigger(Unknown
Source)
at
org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(Unknown
Source)
at
org.apache.derby.impl.sql.execute.UpdateResultSet.fireAfterTriggers(Unknown
Source)
at org.apache.derby.impl.sql.execute.UpdateResultSet.open(Unknown
Source)
at
org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown
Source)
at
org.apache.derby.impl.sql.GenericPreparedStatement.executeSubStatement(Unknown
Source)
at
org.apache.derby.impl.sql.execute.GenericTriggerExecutor.executeSPS(Unknown
Source)
at
org.apache.derby.impl.sql.execute.RowTriggerExecutor.fireTrigger(Unknown
Source)
at
org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(Unknown
Source)
at
org.apache.derby.impl.sql.execute.UpdateResultSet.fireAfterTriggers(Unknown
Source)
at org.apache.derby.impl.sql.execute.UpdateResultSet.open(Unknown
Source)
at
org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown
Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
Source)
Caused: java.sql.SQLException: Java exception: ':
java.lang.NullPointerException'.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
Source)
Caused: java.sql.SQLException: Java exception: ':
java.lang.NullPointerException'.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
Source)
at org.apache.derby.impl.jdbc.Conn