You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "baba shinde (JIRA)" <ji...@apache.org> on 2009/08/03 07:23:14 UTC

[jira] Created: (DERBY-4332) Issue in Derby Database while fetching CLOB datatype or while commiting the transaction.

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
    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.


[jira] Commented: (DERBY-4332) Issue in Derby Database while fetching CLOB datatype or while commiting the transaction.

Posted by "baba shinde (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12739897#action_12739897 ] 

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

answering to your questions in the last comment 
 - Are you using SSL? 
   The logs I sent to you is not with SSL enabled connection, but I tried with the SSL enabled connection still error occures

- Are you getting the SSL error message on an already established connection, or during connect? 
  I get this error while firing the query on database not while establishing the connection.

 - Are you using XA? 
  Yes I am using transactional connection over database with the help of database connection pool (dbcp). Autocomit on connection is set to false, I am explicitly saying connection.comit() after every update call on database.

- What does your connection URL(s) look like? 
 " jdbc:derby://localhost:1527/JUnit_Test;create=true;user=test_user;password=password" this is the connection URL I am using in my test cases. 
and "jdbc:derby://localhost:1527/JUnit_Test;create=true;ssl=peerAuthentication" in case of SSL enabled connection.

I have tested my application on 10.5.2 release but still getting inconsistent behavior of test cases, and getting same exception as stated in my last comment.


> 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.


[jira] Commented: (DERBY-4332) Issue in Derby Database while fetching CLOB datatype or while commiting the transaction.

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805847#action_12805847 ] 

Kristian Waagan commented on DERBY-4332:
----------------------------------------

Unless you can provide a working repro, I'm at a loss here.

Some LOB issues have already been fixed, and more fixes will go into 10.6. There is a slight chance that you are hitting one of the existing issues. Maybe you can try running your application/script with 10.6 when it comes out?
Another thing to consider is trying to run your application with the embedded driver to verify that the code works there - this might help us isolate the 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.


[jira] Commented: (DERBY-4332) Issue in Derby Database while fetching CLOB datatype or while commiting the transaction.

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12739450#action_12739450 ] 

Kristian Waagan commented on DERBY-4332:
----------------------------------------

I don't have enough information to help. The environment seems a bit too complex to start looking "in the dark" for the problem.
All I have to offer at the moment, are further questions;
 - Are you using SSL?
 - Are you getting the SSL error message on an already established connection, or during connect?
 - Are you using XA?
 - What does your connection URL(s) look like?

We have some reports of similar problems at the moment, but they seem to be somehow more isolated.
Suggestions going forward;
 - Try out the 10.5.2 release candidate
 - Post a running (minimal) repro for one or more of the problems.


Regarding Derby and the locator enabled LOBs, would it be an idea to add tracing for creation and freeing of locators? This would have to be added in both the client driver and the server to be complete. I think we have the required frameworks on both sides. Maybe using JMX to obtain a list of "live" locators on the server is another option.

> 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.


[jira] Resolved: (DERBY-4332) Issue in Derby Database while fetching CLOB datatype or while commiting the transaction.

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan resolved DERBY-4332.
------------------------------------

    Resolution: Incomplete

I'm marking this issue as incomplete.
The description says the bug/issue is intermittent, which makes it harder to write a repro.

If a runnable repro is attached, please reopen this issue.

> 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.


[jira] Commented: (DERBY-4332) Issue in Derby Database while fetching CLOB datatype or while commiting the transaction.

Posted by "baba shinde (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (DERBY-4332) Issue in Derby Database while fetching CLOB datatype or while commiting the transaction.

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan updated DERBY-4332:
-----------------------------------

           Component/s: Network Client
               Urgency: Normal  (was: Blocker)
    Bug behavior facts: [Crash]  (was: [Security, Crash])

Unticked security, set urgency to normal. Added component Network Client.
If ticking the Security checkbox was intended, please tick it again.

Baba,
 - Is it possible for you to provide the failing repro / test cases you mention?
 - If you enable more verbose logging [1], do you see anything in derby.log before the errors on the client side happen?


[1] For instance, set 'derby.stream.error.logSeverityLevel=0' and 'derby.language.logStatementText=true'.


> 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.