pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: Will Connection.createBlob be implemented any time soon?
Date: Sun, 19 Jan 2014 14:31:00 +0100
Message-ID: <lbgk12$252$1@ger.gmane.org> (raw)
In-Reply-To: <OfficeNetEmail.3f.a807f64e9f620e86.143aaa18da2@prod2>
References: <OfficeNetEmail.3f.a807f64e9f620e86.143aaa18da2@prod2>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Andreas Joseph Krogh wrote on 19.01.2014 14:14:
> $subject
> It'd be nice to be able to do:
>                  val b = con.createBlob()
>                  val os = b.setBinaryStream(1)
>                  IOUtils.copyLarge(is, os, new Array[Byte](1024 * 1024))
> Is there a work-around for it?

Using PreparedStatement.setBinaryStream() works without problems.
You don't even need the intermediate Blob instance:

PreparedStatement pstmt = con.createStatement("....");

pstmt.setBinaryStream(1, is);
   or
pstmt.setBinaryStream(1, is, length);  // if the length is known






-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (18+ messages)  latest in thread

Message-ID: <lbgk12$252$1@ger.gmane.org>
Permalink:  ../lbgk12$252$1@ger.gmane.org/
Also on:    postgresql.org/message-id/lbgk12$252$1@ger.gmane.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: Will Connection.createBlob be implemented any time soon?
  In-Reply-To: <lbgk12$252$1@ger.gmane.org>
  References: <OfficeNetEmail.3f.a807f64e9f620e86.143aaa18da2@prod2> <lbgk12$252$1@ger.gmane.org>

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

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