agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Andreas Joseph Krogh <andreas@visena.com>
To: pgsql-sql@postgresql.org
Subject: Re: BYTEA
Date: Sun, 17 Jan 2016 23:09:23 +0100 (CET)
Message-ID: <VisenaEmail.a6.78adcc60bfbadadb.15251a22a3f@tc7-visena> (raw)
In-Reply-To: <569BF994.1060909@aklaver.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

På søndag 17. januar 2016 kl. 21:29:08, skrev Adrian Klaver <
adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>:
On 01/17/2016 11:33 AM, Eugene Yin wrote:
 > Pg 9.4+
 >
 > Storing binary data using bytea
 > <http://www.postgresql.org/docs/8.4/static/datatype-binary.html; or text
 > <http://www.postgresql.org/docs/8.4/static/datatype-character.html; data
 > types
 >
 >   * Pluses
 >       o Storing and Accessing entry utilizes the same interface when
 >         accessing any other data type or record.
 >       o No need to track OID of a "large object" you create
 >   * Minus
 >       o bytea and text data type both use TOAST
 >         <http://www.postgresql.org/docs/8.4/static/storage-toast.html;
 >         (details here <https://wiki.postgresql.org/wiki/TOAST;)
 >           + limited to 1G per entry
 >           + 4 Billion (> 2KB) entries per table max
 >             <https://wiki.postgresql.org/wiki/TOAST;.
 >       o *Need to escape/encode binary data before sending to DB then do
 >         the reverse after retrieving the data *
 >       o Memory requirements on the server can be steep even on a small
 >         record set.
 >
 > https://wiki.postgresql.org/wiki/BinaryFilesInDB
 >
 >
 >
 > Do I  really *Need to escape/encode binary data before sending to DB
 > then do the reverse after retrieving the data?*
 > *
 > *
 > If so, what (*Java*) codes should I use to achieve this goal (I am using
 > the Java to interface with the DB)?

 https://jdbc.postgresql.org/documentation/94/binary-data.html
 
Save yourself the trouble and don't go this route. Use 
https://github.com/impossibl/pgjdbc-ng instead.
 
-- Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
andreas@visena.com <mailto:andreas@visena.com>
www.visena.com <https://www.visena.com;
 <https://www.visena.com;


 

view thread (17+ messages)  latest in thread

Message-ID: <VisenaEmail.a6.78adcc60bfbadadb.15251a22a3f@tc7-visena>
Permalink:  ../VisenaEmail.a6.78adcc60bfbadadb.15251a22a3f@tc7-visena/
Also on:    postgresql.org/message-id/VisenaEmail.a6.78adcc60bfbadadb.15251a22a3f@tc7-visena

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andreas@visena.com
  Subject: Re: BYTEA
  In-Reply-To: <VisenaEmail.a6.78adcc60bfbadadb.15251a22a3f@tc7-visena>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox