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

State of InputStream retrieved from resultset is not clean , if there exists previous InputStream .

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 10.2.1.6
    • JDBC, Network Client
    • None
    • Release Note Needed

    Description

      State of InputStream retrieved from ResultSet was not clean , if there exists previous InputStream retrieved from ResultSet .

      Test code ...
      PreparedStatement pst = conn.prepareStatement("insert into a(b) values");

      byte[] data = new byte[1024 * 1024];
      for(int i = 0;
      i < 1024 * 1024;
      i ++)

      { data[i] = (byte)(i % 256); }

      pst.setBinaryStream(1,new ByteArrayInputStream(data),data.length);
      pst.executeUpdate();
      pst.close();

      st = conn.createStatement();
      ResultSet rs = st.executeQuery("select b from a");
      rs.next();

      InputStream is = rs.getBinaryStream(1);
      System.out.println("Here goes first stream");
      System.out.println(is.read());
      System.out.println(is.read());
      System.out.println(is.read());

      is = rs.getBinaryStream(1);
      System.out.println("Here goes 2nd stream");
      System.out.println(is.read());
      System.out.println(is.read());
      System.out.println(is.read());

      Result ....
      naka@rufelza:~/derby/test/20051121$ java testLob
      Here goes first stream
      0
      1
      2
      Here goes 2nd stream
      7
      8
      9

      It is expected that result printed from first stream is as same as result printed from 2nd.

      Attachments

        1. testLob.java
          2 kB
          Tomohito Nakayama
        2. testResult.txt
          0.1 kB
          Tomohito Nakayama
        3. DERBY-721.patch
          6 kB
          Tomohito Nakayama
        4. testLob2.java
          2 kB
          Tomohito Nakayama
        5. testResult2.txt
          0.1 kB
          Tomohito Nakayama
        6. DERBY-721_2.patch
          6 kB
          Tomohito Nakayama
        7. DERBY-721_3.patch
          5 kB
          Tomohito Nakayama
        8. DERBY-721_rollback_1+2.patch
          10 kB
          Tomohito Nakayama
        9. DERBY-721_4.patch
          180 kB
          Tomohito Nakayama
        10. DERBY-721_5.patch
          0.9 kB
          Tomohito Nakayama

        Issue Links

          Activity

            People

              tmnk Tomohito Nakayama
              tmnk Tomohito Nakayama
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: