-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Torsten,

On 8/28/18 09:27, Torsten Krah wrote:
> Am Dienstag, den 28.08.2018, 09:21 -0400 schrieb Christopher
> Schultz:
>> Interesting. I wonder why Postgres decided not to support that 
>> through the standard JDBC API.
>> 
>> Have you tried setting the "compatible" flag on the connection
>> just to see if it works for you?
> 
> I am curious - afaik the standard JDBC API does not support e.g. to
> use seek() or truncate() on the BLOB to fast forward to some
> position in the file - how would you do that with the standard API
> Christopher - maybe i've missed that feature?
> 
> The LargeObject API does support this.

I've never tried doing random-access reads into BLOBs in a database
before... that seems like an architectural mistake to me.

But if I had to, I'd try to:

ResultSet rs = ...;
Blob blob = rs.getBlob("bigfield");

// Take a chunk out of the middle
byte[] chunk = blob.getBytes(start, length);
// or
InputStream readFromMiddle = blob.getBinaryStream(strart, length);

// Truncate the blob
blob.truncate(newEndPos);

The Blob API isn't really that extensive... I'm not sure how you could
have missed those methods in there. It's really all there is.

Now... if Postgres artificially places a 1GiB limit on everything that
goes through that API, well, then you are kind of screwed.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluFWbwACgkQHPApP6U8
pFgpoxAAtWj6cROWQXgw/r6H/OeoHnOZI262JqajXi7L3QycYzVwNENNQ1v+fKNS
AegRgAUTDnw0KBk2hPkZHaCEcNIuzshvxA9Vs2ptLynwEjoGXD17+ZXR85uy4Iq/
bfmnhSAbDRiNg9VoTFw4Vmbx+dNXZUT8jfkGdWWvTH/27yws72vXSLH/bhnAa/IU
R1eNqmWGbBIQiQaWk2YhSDKWfuQoNUXxiJPYR07u4MhtxGctPHN7nudZb2ZjFGaF
qCidhoE6/tuNzkpLyMvrvMGHGCR3mP9Vc1UyHtwwckPTCV+rctV2MfpD7RG00K+m
ABlhCpkw7n0YEGFe2GQet7xF5dB8aLtcv/XimE0/rkQzhzwMkFtRLS30ONwoCiPh
ID3gLWOmLaAtlCjgO3/FWZbYqxs2yZYyO3xerukHoji4bUYPwfa1otJBQwrjVgZI
OQGx4Wy173fjRsIXxdUzgw5hpwocLodtu/U+NGWWpTNNq83/1hw8hEaMHl3p729E
qifq7DDAnws5nlchr2Njf24tScmNtqw1IZV5T2MU3LDvrhi3t5RukuMe5sSyl6S6
wEqVfSVHNP/IP7XxtpalwbKSiU0D0kwTA9iBmOPA+aQfD05kFKAD9wT9YHgF5wAw
NGFZBgIaB374sJWZgMQRl/dfHNrrfXV9Lk7OnHk+vXsrakd2O24=
=6hok
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to