[ 
https://issues.apache.org/jira/browse/DERBY-7134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17718607#comment-17718607
 ] 

Dario Lucia commented on DERBY-7134:
------------------------------------

I hit a similar problem, same issue.

The table is defined as:

{{CREATE TABLE ACK_MESSAGE_TABLE (}}
{{  UniqueId BIGINT NOT NULL,}}
{{  GenerationTime TIMESTAMP NOT NULL,}}
{{  MessageId BIGINT NOT NULL,}}
{{  State SMALLINT NOT NULL,}}
{{  UserName VARCHAR(32),}}
{{  AcknowledgementTime TIMESTAMP,}}
{{  AdditionalData BLOB,}}
{{  PRIMARY KEY (UniqueId)}}
{{)}}

I get an exception (same reported by [~tlussnig] ), when my code tries to 
prepare a statement:

{{@Override}}
{{protected PreparedStatement createStoreStatement(Connection connection) 
throws SQLException {}}
{{   if(LOG.isLoggable(Level.FINEST)) {}}
{{      LOG.finest(this + " - preparing store statement: " + STORE_STATEMENT);}}
{{   }}}
{{   return connection.prepareStatement(STORE_STATEMENT); // <-- Exception 
here}}
{{}}}

{{The }}{{STORE_STATEMENT }}{{is this one:}}

{{private static final String STORE_STATEMENT = "MERGE INTO ACK_MESSAGE_TABLE 
USING SYSIBM.SYSDUMMY1 ON UniqueId = ? " +}}
{{"WHEN MATCHED THEN UPDATE SET GenerationTime = ?, MessageId = ?, State = ?, 
UserName = ?, AcknowledgementTime = ?, AdditionalData = ? " +}}
{{"WHEN NOT MATCHED THEN INSERT 
(UniqueId,GenerationTime,MessageId,State,UserName,AcknowledgementTime,AdditionalData)
 VALUES (?,?,?,?,?,?,?)";}}

The statement works perfectly when Derby is in embedded mode. As soon as I 
start it in network mode and I connect remotely, I have an exception on my 
side, as per StackOverflow topic linked in the first post. And on the server, 
Derby complains about a NullPointerException, as per report:

java.lang.NullPointerException: Cannot invoke "String.length()" because 
"<parameter1>" is null

 

 

> MERGE not Working over Nework
> -----------------------------
>
>                 Key: DERBY-7134
>                 URL: https://issues.apache.org/jira/browse/DERBY-7134
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions: 10.15.2.0
>         Environment: Windows , Derby 
>            Reporter: Thomas Lußnig
>            Priority: Major
>
> I Receive an error after sending Merge Statement via Netowrk to derby network 
> server.
> The error was first mentioned 5 Years ago:
>  * 
> [https://stackoverflow.com/questions/41587515/derby-merge-statement-results-in-insufficient-data-while-reading-from-the-netwo]
> And is till now active in derby.
> SQL-Fehler: Unzureichende Daten beim Lesen aus dem Netz. Erwartet wurden 
> mindestens 21.272 Byte, empfangen wurden jedoch nur 0 Byte. Die Verbindung 
> wurde beendet.
> MERGE INTO HUND USING SYSIBM.SYSDUMMY1 ON HUND.name='name'
>     WHEN MATCHED THEN UPDATE SET zwinger='ZW',zbn='zb'
>     WHEN NOT MATCHED THEN INSERT (name,zwinger,zbn)VALUES('a','zw','zb')
>     ;
> Tue Mar 08 07:23:32 CET 2022 : Cannot invoke "String.length()" because 
> "<parameter1>" is null
> java.lang.NullPointerException: Cannot invoke "String.length()" because 
> "<parameter1>" is null
>     at 
> org.apache.derby.impl.drda.DDMWriter.maxEncodedLength(DDMWriter.java:1138)
>     at org.apache.derby.impl.drda.DDMWriter.writeString(DDMWriter.java:1252)
>     at 
> org.apache.derby.impl.drda.DRDAConnThread.writeSQLCAGRP(DRDAConnThread.java:6338)
>     at 
> org.apache.derby.impl.drda.DRDAConnThread.writeSQLCARD(DRDAConnThread.java:6167)
>     at 
> org.apache.derby.impl.drda.DRDAConnThread.writeSQLCARDs(DRDAConnThread.java:6109)
>     at 
> org.apache.derby.impl.drda.DRDAConnThread.processCommands(DRDAConnThread.java:836)
>     at org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:300)
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to