Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30460
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: jdbc setBinaryStream |
| Date | 2014-12-01 14:06 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <m5hske$fqv$1@dont-email.me> (permalink) |
| References | <slrnm7jn16.uoi.avl@login.logic.tuwien.ac.at> <m5d8ii$cch$1@dont-email.me> <slrnm7kbj7.uoi.avl@login.logic.tuwien.ac.at> <m5dn48$1ci$1@dont-email.me> <slrnm7mc14.uoi.avl@login.logic.tuwien.ac.at> |
On Sun, 30 Nov 2014 14:56:21 +0000, Andreas Leitgeb wrote: > I didn't yet come across clob or text so that's not an area I really > know about. > In some databases they can be quite weird, explicitly being stored external to the table that defines them. There's not a lot of detail on how Postgres stores them: you just declare the column as 'text' type and use it as you would a character varying column except that it doesn't have size limitations. In fact, Postgres recommends the use of text in preference to character(n) or character varying(n) because it doesn't have any length checking overheads. > I'd however expect certain functionality, such as being able to store > international characters, and have the database really know the actual > characters for stuff like collation etc. > > Also, it is clear, that at some point, a stream of single bytes flows > between client and server. > > In my naive imagination, I'd have expected, that Jdbc (the J stands for > Java, doesn't it?) would define a text/clob interface in terms of char, > thus Reader/Writer (and internally pick it's own byte encoding based on > best performance for actual transfer). > Well, it ain't so, whatever the reasons, maybe even good ones. > Probably due to the potential length of a text field? > Aren't these already base64'd in the MIME message? So the db sees them > even as 7 bit ascii :-) > Correct. > But even if your message had some cjk text in it, the db sees 8 bits, > may interpret them as any 8bit encoding e.g. windows-1251, convert to > unicode (e.g. utf-16 like java) and upon converting back for read-out, > it'll produce exactly the same byte stream. > I think you'll find that the RFCs for e-mail specify that a message body must use 8 bit characters - which is why a MIME part with content other than ASCII or UTF-8 will be encoded as base64 or something else that can be represented as 8 bit characters. I used a character type representation rather than blobs because of the RFCs requiring that a message body and headers must be 8-bit characters. > Just for "scientific" curiosity, I'd suggest to create a new table in > your db like the one you have, but with text turned to blob (or long- > varbyte), and measure performance and also check the actual disk-space > consumption of a text/clob versus blob. I'd expect much more overhead > from clob compared to blob, but if the database is simple/old enough and > sees "text" only in 8bit locales, then that difference might not even > show up. > I'll bear it in mind next time I design a database - the mail archive is far to big to be messed about with at 4.9 GB. > I hope you did also check the contents, not just the number of bytes ;-) > Of course. -- 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
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