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

baba shinde commented on DERBY-4332:
------------------------------------

Hi Kristin,
  Thanks for quick reply, 

pseudo code for my JUnit test case is:
1//put message in database table MessageTable(which has the CLOB data type as 
one of the field )
2//update message field in the database based on some condition.
3//get message from database by messageId.(its code is given below)

String str = ""; 
    getMessageStmt.setString(1, messageId); 
     ResultSet resultSet = getMessageStmt.executeQuery(); 
     Clob clob = null; 
     if (resultSet.next()) { 
        clob = resultSet.getClob(1); 
        try { 
          str = clobStringConversion(clob); 
        } catch (IOException e) { 
          throw new SQLException("Failed to convert CLOB to String.", e); 
        } 
      } else { 
        log.info("No record found for the messageId: " + messageId); 
        return null; 
      } 
      connection.commit(); 
      resultSet.close(); 

4//  remove message from database..

I have enabled the verbose logging for my application still the inconsistent 
behavior of test cases can be seen.  Below is the error i am getting while 
running test case.

Database Class Loader started - derby.database.classpath=''
2009-08-05 06:19:59.341 GMT Thread[DRDAConnThread_8,5,main] (DATABASE = 
JUnit_Test), (DRDAID = NF000001.GB74-579837202570752097{28}), Execution failed 
because of a Distributed Protocol Error:  DRDA_Proto_SYNTAXRM; CODPNT arg  = 0; 
Error Code Value = 3. Plaintext connection attempt from an SSL enabled client?
2009-08-05 06:19:59.341 GMT : Execution failed because of a Distributed 
Protocol Error:  DRDA_Proto_SYNTAXRM; CODPNT arg  = 0; Error Code Value = 3. 
Plaintext connection attempt from an SSL enabled client?
org.apache.derby.impl.drda.DRDAProtocolException: Execution failed because of a 
Distributed Protocol Error:  DRDA_Proto_SYNTAXRM; CODPNT arg  = 0; Error Code 
Value = 3. Plaintext connection attempt from an SSL enabled client?
        at org.apache.derby.impl.drda.DRDAConnThread.throwSyntaxrm(Unknown 
Source)
        at org.apache.derby.impl.drda.DDMReader.readDssHeader(Unknown Source)
        at org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown 
Source)
        at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)
2009-08-05 06:19:59.341 GMT Thread[DRDAConnThread_8,5,main] (DATABASE = 
JUnit_Test), (DRDAID = NF000001.GB74-579837202570752097{28}), Execution failed 
because of a Distributed Protocol Error:  DRDA_Proto_SYNTAXRM; CODPNT arg  = 0; 
Error Code Value = 3. Plaintext connection attempt from an SSL enabled client?
2009-08-05 06:19:59.341 GMT : Execution failed because of a Distributed 
Protocol Error:  DRDA_Proto_SYNTAXRM; CODPNT arg  = 0; Error Code Value = 3. 
Plaintext connection attempt from an SSL enabled client?
org.apache.derby.impl.drda.DRDAProtocolException: Execution failed because of a 
Distributed Protocol Error:  DRDA_Proto_SYNTAXRM; CODPNT arg  = 0; Error Code 
Value = 3. Plaintext connection attempt from an SSL enabled client?
        at org.apache.derby.impl.drda.DRDAConnThread.throwSyntaxrm(Unknown 
Source)
        at org.apache.derby.impl.drda.DDMReader.readDssHeader(Unknown Source)
        at org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown 
Source)
        at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)

Could you please help me out on this problem.

> Issue in Derby Database while fetching CLOB datatype or while commiting the 
> transaction.
> ----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4332
>                 URL: https://issues.apache.org/jira/browse/DERBY-4332
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client
>    Affects Versions: 10.5.1.1
>         Environment: Windows XP SP2, machine: core 2 duo processor, 2GM 
> primary mem.
>            Reporter: baba shinde
>            Priority: Critical
>
> I am using Derby database for my application where auto commit on connection 
> is set to false and I am doing the manual commit after every database update 
> calls. In my application I am using CLOB data type to store the large string 
> data in table column. And there are couples of test cases written to ensure 
> the database working, but it has found very weird/inconsistent behavior of 
> database either while fetching the data or while deleting the fetched data 
> from database table. Probability of passing the test cases is 50 %( half of 
> the time test cases fails and half of the time all test cases cleanly passes 
> through)
> Inconsistent behavior in the sense: every time code fails for either of the 
> exception given below:
> 1) This exception occurs while removing the record from database.
> Exception in thread "TestHandler-2-thread-1" 
> java.lang.ArrayIndexOutOfBoundsException: -1
> at org.apache.derby.client.net.Request.popMark(Unknown Source)
> at org.apache.derby.client.net.Request.updateLengthBytes(Unknown Source)
> at org.apache.derby.client.net.NetStatementRequest.buildEXCSQLSTT(Unknown 
> Source)
> at org.apache.derby.client.net.NetStatementRequest.writeExecute(Unknown 
> Source)
> at org.apache.derby.client.net.NetPreparedStatement.writeExecute_(Unknown 
> Source)
> at org.apache.derby.client.am.PreparedStatement.writeExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeX(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.execute(Unknown Source)
> code snippet for the same is:
> try {
>       removeMessageStmt.setString(1, messageId);
>       removeMessageStmt.execute();
>       connection.commit();
>     } catch (SQLException e) {
>       try {
>         connection.rollback();
>       } catch (SQLException tx) {
>         log.error("Failed to rollback the transaction", tx);
>       }
>   }
> where removeMessageStmt is the prepared statement initialize at start.
> 2) java.sql.SQLNonTransientConnectionException: No current connection. 
> Exception in connection.rollback()
> at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
> Source) [derbyclient.jar:na]
> at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) 
> [derbyclient.jar:na]
> at org.apache.derby.client.am.Connection.rollback(Unknown Source) 
> [derbyclient.jar:na]
> at 
> org.apache.commons.dbcp.DelegatingConnection.rollback(DelegatingConnection.java:328)
>  [commons-dbcp-1.2.2.jar:1.2.2]
> Caused by: org.apache.derby.client.am.SqlException: No current connection.
> at org.apache.derby.client.am.Connection.checkForClosedConnection(Unknown 
> Source) [derbyclient.jar:na]
> ... 20 common frames omitted
> Caused by: java.sql.SQLNonTransientConnectionException: A network protocol 
> error was encountered and the connection has been terminated: A PROTOCOL Data 
> Stream Syntax Error was detected.  Reason: 0x2,644. Plaintext connection 
> attempt to an SSL enabled server?
> at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
> Source) [derbyclient.jar:na]
> at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) 
> [derbyclient.jar:na]
> at org.apache.derby.client.am.PreparedStatement.execute(Unknown Source) 
> [derbyclient.jar:na]
> at 
> org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169)
>  [commons-dbcp-1.2.2.jar:1.2.2]
> I ran the test cases on SSL enabled connection but eror still exists. 
> 3) some times it gives throws an exception while while fetching the CLOB data 
> from database tables.   
> The exception 'java.sql.SQLException: The locator that was supplied for this 
> CLOB/BLOB is invalid' was thrown while evaluating an expression.
> You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling the 
> free() method or after the Blob/Clob's transaction has been committed or 
> rolled back. 
> this occurs even if I am using connection with auto commit false and 
> committing on connection before result set is closed. code snippet for the 
> same is:
>     String str = "";
>     getMessageStmt.setString(1, messageId);
>      ResultSet resultSet = getMessageStmt.executeQuery();
>      Clob clob = null;
>      if (resultSet.next()) {
>         clob = resultSet.getClob(1);
>         try {
>           str  = clobStringConversion(clob);
>         } catch (IOException e) {
>           throw new SQLException("Failed to convert CLOB to String.", e);
>         }
>       } else {
>         log.info("No record found for the messageId: " + messageId);
>         return null;
>       }
>       connection.commit();
>       resultSet.close();
>     
> where *getMessageStmt is the preparedStatement initialized at start of 
> application
> I appreciate any help or pointers you can provide!
> Thanks and Regards,
> Baba

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to