Re: Will Connection.createBlob be implemented any time soon?

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Will Connection.createBlob be implemented any time soon?
Date: 2014-01-19 13:31:00
Message-ID: lbgk12$252$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Andreas Joseph Krogh 2014-01-19 13:41:35 Re: Will Connection.createBlob be implemented any time soon?
Previous Message Andreas Joseph Krogh 2014-01-19 13:14:29 Will Connection.createBlob be implemented any time soon?