Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3085

Fails to handle BLOB fields with a PreparedStatement with size >32750 bytes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.2.1.6, 10.2.2.0, 10.3.1.4
    • 10.2.2.1, 10.3.2.1, 10.4.1.3
    • JDBC, Network Client
    • None
    • Windows XP SP2
    • Patch Available
    • Regression

    Description

      Java Version: 1.6.0_02
      Java Vendor: Sun Microsystems Inc.
      Java home: C:\Program Files\Java\jre1.6.0_02
      Java classpath: derbytools.jar
      OS name: Windows XP
      OS architecture: x86
      OS version: 5.1
      Java user name: Ma
      Java user home: C:\Documents and Settings\ma
      Java user dir: c:\tools\derby\lib
      java.specification.name: Java Platform API Specification
      java.specification.version: 1.6
      --------- Derby Information --------
      JRE - JDBC: Java SE 6 - JDBC 4.0
      [C:\tools\derby\lib\derbytools.jar] 10.3.1.4 - (561794)

      The following code fails:
      // Data is a byte[] vector
      ByteArrayInputStream is = new ByteArrayInputStream( data);
      String sql = "UPDATE MyTable SET FContents=? WHERE FName='" + name + "'";
      PreparedStatement ps = conn.prepareStatement( sql);
      ps.setBinaryStream( 1, is, data.length);

      if( ps.executeUpdate() == 0)

      { // it throws an exception here if the data array us larger then around 32750 bytes!!! }

      It look's like when the size of the data[] vector is > 32750 bytes or so it throws an exception like this:
      java.sql.SQLException: A network protocol error was encountered and the connection has been terminated: A PROTOCOL Data Stream Syntax Error was detected. Reason: 0x0. Plaintext connection attempt to an SSL enabled server?
      at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
      at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
      at org.apache.derby.client.am.PreparedStatement.executeUpdate(Unknown Source)

      The table is defined as:
      CREATE TABLE MyTable (FName varchar(300) NOT NULL,FContents BLOB(16M) NOT NULL)

      It does loook like this only happens with the NetWork client driver, the embedded driver works fine.

      Attachments

        1. derby-3085_stat2.txt
          0.2 kB
          Katherine Marsden
        2. derby-3085_diff2.txt
          12 kB
          Katherine Marsden
        3. derby-3085_stat.txt
          0.2 kB
          Katherine Marsden
        4. derby-3085_diff.txt
          9 kB
          Katherine Marsden
        5. trace.out.withrow
          251 kB
          Katherine Marsden
        6. trace.out.norows
          250 kB
          Katherine Marsden
        7. TestBlob.java
          1 kB
          Katherine Marsden

        Activity

          People

            kmarsden Katherine Marsden
            mikael_aronsson Mikael Aronsson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: