pg.ddx.io pgsql-jdbc@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Satish Burnwal (sburnwal) <sburnwal@cisco.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: How to use JDBC to update LargeObject
Date: Thu, 21 Jan 2010 09:56:53 +0200
Message-ID: <4B5808C5.4050906@enterprisedb.com> (raw)
In-Reply-To: <3A8C969225424C4D8E6BEE65ED8552DA89D653@XMB-BGL-41C.cisco.com>
References: <3A8C969225424C4D8E6BEE65ED8552DA89D653@XMB-BGL-41C.cisco.com>
Satish Burnwal (sburnwal) wrote:
> I am using 8.1 Postgre JDBC. I want to know how can I use JDBC to
> update the contents of a LargeObject. For example, say I have created
> a LO for a file with 1 Mb of data. Later on, file contents have
> changed and are now just 100 kb and I want to update the LO. When I
> try to write to a large object using the method largeObject.write(byte
> [], off, len), it seems to be updating the first 100 kb data, not
> really replacing the existing 100 MB with the new data. pg_largeobject
> table still shows the same number of rows. Any idea how can I update
> the contents of a large object.
See manual, http://jdbc.postgresql.org/documentation/84/binary-data.html:
" To use the Large Object functionality you can use either the
LargeObject class provided by the PostgreSQLâ„¢ JDBC driver, or by using
the getBLOB() and setBLOB() methods.
Important
You must access Large Objects within an SQL transaction block. You can
start a transaction block by calling setAutoCommit(false). "
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
view thread (6+ messages) latest in thread
Message-ID: <4B5808C5.4050906@enterprisedb.com> Permalink: ../4B5808C5.4050906@enterprisedb.com/ Also on: postgresql.org/message-id/4B5808C5.4050906@enterprisedb.com ·
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: heikki.linnakangas@enterprisedb.com, sburnwal@cisco.com Subject: Re: How to use JDBC to update LargeObject In-Reply-To: <4B5808C5.4050906@enterprisedb.com> References: <3A8C969225424C4D8E6BEE65ED8552DA89D653@XMB-BGL-41C.cisco.com> <4B5808C5.4050906@enterprisedb.com> * 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