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


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

Re: jdbc setBinaryStream

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: jdbc setBinaryStream
Date 2014-11-29 19:59 +0000
Organization A noiseless patient Spider
Message-ID <m5d8ii$cch$1@dont-email.me> (permalink)
References <slrnm7jn16.uoi.avl@login.logic.tuwien.ac.at>

Show all headers | 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