Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30443
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Daniele Futtorovic <da.futt.news@laposte.net> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: jdbc setBinaryStream |
| Date | Sat, 29 Nov 2014 16:57:56 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 36 |
| Message-ID | <m5cqds$t9c$1@dont-email.me> (permalink) |
| References | <slrnm7jn16.uoi.avl@login.logic.tuwien.ac.at> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sat, 29 Nov 2014 15:57:49 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="aee7c1c65e1358c364f5bfd2f936b4cf"; logging-data="29996"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/BOI+apJDjebdo2H61CEaK" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
| In-Reply-To | <slrnm7jn16.uoi.avl@login.logic.tuwien.ac.at> |
| Cancel-Lock | sha1:F+0NH0ZeBd88hrlSyyB8FecNorc= |
| Xref | csiph.com comp.lang.java.programmer:30443 |
Show key headers only | View raw
On 2014-11-29 15:45, Andreas Leitgeb wrote: > What I need is like > insert into sometable values ( 0, ? ) > where the relevant column is a varlongbinary (not blob) and > it is fed from an external data source accessed through a > custom InputStream. > > I create a PreparedStatement "prep" for the query and: > InputStream source = ... (some custom InputStream) > prep.setBinaryStream(1, source ); // the one with no length > > > Problem is, it ignores my stream altogether. Eclipse breakpoints on > read methods never trigger. It just silently inserts an empty object. > > > My custom InputStream implements the no-arg read() and the three-arg > read(arr,off,len). The one-arg read(arr) falls back to the three-args > one by base class's implementation. > > The overload of setBinaryStream without a length parameter is new > in jdbc 4.0, and I read from the docs that it should mean: get as many > bytes as possible from that stream (i.e. until EOF). > Obviously that is not always so - at least not with the informix > server I'm targetting or with the ifxjdbc.jar I got from the server's > jdbc/lib folder. > > Has anyone else run into that problem and perhaps found a solution? > > PS: the only relevant google hit is an unanswered stackoverflow question > http://stackoverflow.com/questions/20471030/setbinarystream-saves-null-values > and that was even for a different db-system than the one I'm targetting. > Have you made sure your InputStream is behaving as you assume it does?
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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