Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 406D263225B for ; Thu, 21 Jan 2010 03:57:10 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 98896-04 for ; Thu, 21 Jan 2010 07:56:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og125.obsmtp.com (exprod7og125.obsmtp.com [64.18.2.28]) by mail.postgresql.org (Postfix) with SMTP id 02B1E6320CC for ; Thu, 21 Jan 2010 03:56:58 -0400 (AST) Received: from source ([209.85.219.217]) by exprod7ob125.postini.com ([64.18.6.12]) with SMTP ID DSNKS1gIyY1zu2rPvPbvRgD8b1kvD9Qe+Kxz@postini.com; Wed, 20 Jan 2010 23:56:58 PST Received: by ewy9 with SMTP id 9so1113191ewy.31 for ; Wed, 20 Jan 2010 23:56:56 -0800 (PST) Received: by 10.213.45.202 with SMTP id g10mr1039974ebf.60.1264060616782; Wed, 20 Jan 2010 23:56:56 -0800 (PST) Received: from ?192.168.1.117? ([88.195.103.165]) by mx.google.com with ESMTPS id 5sm707245eyh.0.2010.01.20.23.56.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 20 Jan 2010 23:56:55 -0800 (PST) Message-ID: <4B5808C5.4050906@enterprisedb.com> Date: Thu, 21 Jan 2010 09:56:53 +0200 From: Heikki Linnakangas Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) MIME-Version: 1.0 To: "Satish Burnwal (sburnwal)" CC: pgsql-jdbc@postgresql.org Subject: Re: How to use JDBC to update LargeObject References: <3A8C969225424C4D8E6BEE65ED8552DA89D653@XMB-BGL-41C.cisco.com> In-Reply-To: <3A8C969225424C4D8E6BEE65ED8552DA89D653@XMB-BGL-41C.cisco.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201001/59 X-Sequence-Number: 20255 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