Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W4t4k-0002tA-Hc for pgsql-jdbc@arkaria.postgresql.org; Sun, 19 Jan 2014 14:10:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W4t4k-000162-13 for pgsql-jdbc@arkaria.postgresql.org; Sun, 19 Jan 2014 14:10:10 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W4t4i-00015q-VG for pgsql-jdbc@postgresql.org; Sun, 19 Jan 2014 14:10:09 +0000 Received: from prod2.officenet.no ([195.159.87.246]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W4t4e-0007j3-RO for pgsql-jdbc@postgresql.org; Sun, 19 Jan 2014 14:10:08 +0000 Received: from localhost ([127.0.0.1] helo=prod2) by prod2.officenet.no with esmtp (Exim 4.76) (envelope-from ) id 1W4t2b-0004YT-1M for pgsql-jdbc@postgresql.org; Sun, 19 Jan 2014 15:07:57 +0100 Date: Sun, 19 Jan 2014 15:07:56 +0100 (CET) From: Andreas Joseph Krogh To: pgsql-jdbc@postgresql.org Message-ID: In-Reply-To: Subject: Re: Will Connection.createBlob be implemented any time soon? MIME-Version: 1.0 X-Mailer: OfficeNet Mail 1.9.0-SNAPSHOT X-Pg-Spam-Score: -2.4 (--) Content-Type: multipart/alternative; boundary="----=_Part_62_2007068279.1390140476912" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org ------=_Part_60_647907039.1390140476899 Content-Type: multipart/related; boundary="----=_Part_61_1631514183.1390140476899" ------=_Part_61_1631514183.1390140476899 Content-Type: multipart/alternative; boundary="----=_Part_62_2007068279.1390140476912" ------=_Part_62_2007068279.1390140476912 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable P=C3=A5 s=C3=B8ndag 19. januar 2014 kl. 14:58:00, skrev Thomas Kellerer < spam_eater@gmx.net >: Andreas Joseph Krogh wrote= on=20 19.01.2014 14:41: >=C2=A0 =C2=A0 =C2=A0Using PreparedStatement.setBinaryStream() works witho= ut problems. >=C2=A0 =C2=A0 =C2=A0You don't even need the intermediate Blob instance: > >=C2=A0 =C2=A0 =C2=A0PreparedStatement pstmt =3D con.createStatement("....= "); > >=C2=A0 =C2=A0 =C2=A0pstmt.setBinaryStream(1, is); >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0or >=C2=A0 =C2=A0 =C2=A0pstmt.setBinaryStream(1, is, length);=C2=A0 // if the= length is known > > I'm using JPA and need to be able to set a (new) Blob as a field, like t= his: Ah! The joys of database obfuscation layers. Sorry, I can't help you with that. > val b =3D con.createBlob() > val os =3D b.setBinaryStream(1) > IOUtils.copyLarge(is, os, new Array[Byte](1024 * 1024)) > myEntity.setData(b) The above code (val b =3D ...) does not look like Java. What exactly is th= at? =C2=A0=20 Scala, but for this case it is irrelevant. =C2=A0 Is there any reason why= =20 Connection.createBlob isn't implemented in the official driver? The NG-driv= er=20 (https://github.com/impossibl/pgjdbc-ng) has it and it works quite well. I = am,=20 however, experiencing some issues in my app and want to test it with the=20 official driver, but am unable to because it doesn't support createBlob, wh= ich=20 my app needs. =C2=A0 Is it possible to fund development of it and have it m= erged=20 into the official driver? =C2=A0 -- Andreas Joseph Krogh =C2=A0 =C2=A0 =C2=A0 mob: +47 9= 09 56 963 Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no Public key: http://home.officenet.no/~andreak/public_key.asc =C2=A0 ------=_Part_62_2007068279.1390140476912 Content-Type: text/html;charset=UTF-8 Content-Transfer-Encoding: quoted-printable
P=C3=A5 s=C3=B8ndag 19. januar 2014 kl. 14:58:00, skrev Thomas Kellere= r <spam_eater@gm= x.net>:
And= reas Joseph Krogh wrote on 19.01.2014 14:41:
>=C2=A0 =C2=A0 =C2=A0Using PreparedStatement.setBinaryStream() works wit= hout problems.
>=C2=A0 =C2=A0 =C2=A0You don't even need the intermediate Blob instance:=
>
>=C2=A0 =C2=A0 =C2=A0PreparedStatement pstmt =3D con.createStatement(&qu= ot;....");
>
>=C2=A0 =C2=A0 =C2=A0pstmt.setBinaryStream(1, is);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0or
>=C2=A0 =C2=A0 =C2=A0pstmt.setBinaryStream(1, is, length);=C2=A0 // if t= he 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 =3D con.createBlob()
> val os =3D b.setBinaryStream(1)
> IOUtils.copyLarge(is, os, new Array[Byte](1024 * 1024))
> myEntity.setData(b)

The above code (val b =3D ...) does not look like Java. What exactly is tha= t?
=C2=A0
Scala, but for this case it is irrelevant.
=C2=A0
Is there any reason why Connection.createBlob isn't implemented in the= official driver?
The NG-driver (https://github.com/impossibl/pgjdbc-ng) has it and it w= orks quite well. I am, however, experiencing some issues in my app and want= to test it with the official driver, but am unable to because it doesn't s= upport createBlob, which my app needs.
=C2=A0
Is it possible to fund development of it and have it merged into the o= fficial driver?
=C2=A0
--
Andreas Joseph Krogh <andreak@officenet.no>=C2=A0 =C2=A0 =C2=A0 mob: = +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no Public key: http://home.officenet.no/~andreak/public_key.asc
=C2=A0
------=_Part_62_2007068279.1390140476912-- ------=_Part_61_1631514183.1390140476899-- ------=_Part_60_647907039.1390140476899--