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


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

Re: jdbc setBinaryStream

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 Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: jdbc setBinaryStream
Date Sat, 29 Nov 2014 19:59:14 +0000 (UTC)
Organization A noiseless patient Spider
Lines 25
Message-ID <m5d8ii$cch$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 8bit
Injection-Date Sat, 29 Nov 2014 19:59:14 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="e5160e2be48f1ea550cf61512446f525"; logging-data="12689"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18SCFYW5YBaH3F6mzVrFjkXOS5iUHw0Tag="
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
Cancel-Lock sha1:uQVhp8k2SCjCd5LwlkFxlhiWi+o=
Xref csiph.com comp.lang.java.programmer:30448

Show key headers only | View raw


On Sat, 29 Nov 2014 14:45:42 +0000, Andreas Leitgeb wrote:

> Has anyone else run into that problem and perhaps found a solution?
>
I had a similar problem some time back when I was writing my mail 
archiving system, which stores archived e-mail in a PostgreSQL database 
using text fields to store the message body and a subset of it that 
contains searchable text. Text fields can contain arbitrary amounts of 
text: there is no way to specify a size for a text field. I think other 
databases call them CLOBs (Character Large Objects).

The issue was with moving data into and out of these text text fields: 
the only JDBC interface for this data type is via an input or output 
Stream. I ended using ByteArrayOutputStreams to suck the data out of text 
columns into byte[] arrays and ByteArrayInputStreams to push data into 
them. This took a fair bit of head scratching to get it working since I 
kept thinking that the names of these classes were backward: wouldn't you 
expect a ByteArrayOutputStream to drain the byte array rather than fill 
it?


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

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