Skip site navigation (1) Skip section navigation (2)

Re: How to use JDBC to update LargeObject

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: "Satish Burnwal (sburnwal)" <sburnwal(at)cisco(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: How to use JDBC to update LargeObject
Date: 2010-01-21 07:56:53
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
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,

" 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.

You must access Large Objects within an SQL transaction block. You can
start a transaction block by calling setAutoCommit(false). "

  Heikki Linnakangas

In response to


pgsql-jdbc by date

Next:From: Satish Burnwal (sburnwal)Date: 2010-01-21 12:10:29
Subject: Re: How to use JDBC to update LargeObject
Previous:From: Satish Burnwal (sburnwal)Date: 2010-01-21 07:39:51
Subject: How to use JDBC to update LargeObject

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group