Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30453

Re: jdbc setBinaryStream

From Daniele Futtorovic <da.futt.news@laposte.net>
Newsgroups comp.lang.java.programmer
Subject Re: jdbc setBinaryStream
Date 2014-11-30 02:37 +0100
Organization A noiseless patient Spider
Message-ID <m5dsbt$p1u$1@dont-email.me> (permalink)
References <slrnm7jn16.uoi.avl@login.logic.tuwien.ac.at> <m5cqds$t9c$1@dont-email.me> <slrnm7juqs.uoi.avl@login.logic.tuwien.ac.at> <slrnm7k88s.uoi.avl@login.logic.tuwien.ac.at>

Show all headers | View raw


On 2014-11-29 20:39, Andreas Leitgeb wrote:
> Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> wrote:
>> I set breakpoints to all my read-methods (even added available() also
>> with breakpoint)
> 
> I'm quite embarrassed, but still happy to tell, that one of my tests
> namely about the breakpoint in available() was unexpectedly flawn.
> 
> The gist is, that it *does* ask my stream's "available()" count,
> and unlike what the documentation claims about reading till end
> of stream, it reads exactly as many bytes as the available() 
> returned.  A stream's available() is however NOT defined to return
> it's total remaining amount of bytes, but merely the number of bytes
> available *without waiting*, so it is - after all - still a bug.
> 
> Actually, the available() was even called twice in a row: once from
>   setBinaryStream(idx,is)
> apparently to be passed on to a call to
>   setBinaryStream(idx,is,len)
> which again called available(), apparently to verify that the stream
> really had enough bytes "available". (These "apparently"s are based on 
> experiments playing with fixed constants returned from my available()
> or passed to sBS.)
> 
> I really hoped that the new method would allow me to just pass it a
> stream and have jdbc consume it directly into the Db as I thought to
> read from docs, but I'll have to wait for universe version 2 to fix
> this (besides a big big lot of arguably more stringent problems).
> 
> At least I can now deal with it and work around it. (caching it all
> in memory, that is)
> 
> I'd be curious, though, if someone with access to a non-Informix and 
> of course non-critical DB ideally having already tables with blobs could
> try setting breakpoints in his stream class's available() method (even
> if its a standard one) and report about how often it was trapped during
> a setBinaryStream with length versus without length.
> If you don't happen to have such a setup at or near hand, don't bother :)
> 

How about returning, say, Integer.MAX_VALUE in available()? It should
still stall when read() returns -1, shouldn't it?

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

jdbc setBinaryStream Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-11-29 14:45 +0000
  Re: jdbc setBinaryStream Daniele Futtorovic <da.futt.news@laposte.net> - 2014-11-29 16:57 +0100
    Re: jdbc setBinaryStream Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-11-29 16:58 +0000
      Re: jdbc setBinaryStream Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-11-29 19:39 +0000
        Re: jdbc setBinaryStream Daniele Futtorovic <da.futt.news@laposte.net> - 2014-11-30 02:37 +0100
          Re: jdbc setBinaryStream Arne Vajhøj <arne@vajhoej.dk> - 2014-11-29 21:26 -0500
            Re: jdbc setBinaryStream Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-11-30 11:12 +0000
  Re: jdbc setBinaryStream Martin Gregorie <martin@address-in-sig.invalid> - 2014-11-29 19:59 +0000
    Re: jdbc setBinaryStream Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-11-29 20:36 +0000
      Re: jdbc setBinaryStream Martin Gregorie <martin@address-in-sig.invalid> - 2014-11-30 00:07 +0000
        Re: jdbc setBinaryStream Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-11-30 14:56 +0000
          Re: jdbc setBinaryStream Martin Gregorie <martin@address-in-sig.invalid> - 2014-12-01 14:06 +0000
            Re: jdbc setBinaryStream Arne Vajhøj <arne@vajhoej.dk> - 2014-12-01 21:36 -0500
              Re: jdbc setBinaryStream Martin Gregorie <martin@address-in-sig.invalid> - 2014-12-02 12:16 +0000
            Re: jdbc setBinaryStream Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-12-02 17:56 +0000
              Re: jdbc setBinaryStream Martin Gregorie <martin@address-in-sig.invalid> - 2014-12-02 21:37 +0000

csiph-web