Re: Will Connection.createBlob be implemented any time soon? - Mailing list pgsql-jdbc

From Thomas Kellerer
Subject Re: Will Connection.createBlob be implemented any time soon?
Date
Msg-id lbgljj$h3k$1@ger.gmane.org
Whole thread Raw
In response to Re: Will Connection.createBlob be implemented any time soon?  (Andreas Joseph Krogh <andreak@officenet.no>)
Responses Re: Will Connection.createBlob be implemented any time soon?  (Andreas Joseph Krogh <andreak@officenet.no>)
List pgsql-jdbc
Andreas Joseph Krogh wrote on 19.01.2014 14:41:
>     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
>
> I'm using JPA and need to be able to set a (new) Blob as a field, like this:

Ah! The joys of database obfuscation layers.
Sorry, I can't help you with that.

> val b = con.createBlob()
> val os = b.setBinaryStream(1)
> IOUtils.copyLarge(is, os, new Array[Byte](1024 * 1024))
> myEntity.setData(b)

The above code (val b = ...) does not look like Java. What exactly is that?





pgsql-jdbc by date:

Previous
From: Andreas Joseph Krogh
Date:
Subject: Re: Will Connection.createBlob be implemented any time soon?
Next
From: Andreas Joseph Krogh
Date:
Subject: Re: Will Connection.createBlob be implemented any time soon?