Re: Appending to a large object

From: Barry Lind <blind(at)xythos(dot)com>
To: Ole Streicher <ole-usenet-08(at)gmx(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Appending to a large object
Date: 2003-08-07 02:55:56
Message-ID: 3F31BFBC.9030104@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Ole,

The outputstream interface is for reading only. If you want to append
you are going to need to use the LargeObject interface. This is
documented in the PostgreSQL Programmer's Guide. See the section
titled: PostgreSQL Extensions to the JDBC API.

thanks,
--Barry

Ole Streicher wrote:
> Hi,
>
> sorry for bothering you again.
>
> I want to append some data to a LargeObject, but I could not find out
> how to do that. When I simply do
>
> ResultSet rs = queryStmt.executeQuery();
> try {
> if (rs.next()) {
> int oid = rs.getInt(1); // or wherever my Id is
> LargeObject obj = lobj.open(oid);
> System.out.println("SIze is " + obj.size();
> OutputStream os = obj.getOutputStream();
> os.write(...); // here I want to append to the existing stream
> obj.close();
> dbConn.commit();
> }
> } catch (SQLException e) {
> dbConn.rollBack();
> } finally {
> rs.close();
> }
>
> It is not appended to the stream but overwritten from the beginning.
> The LargeObject defines some variables SEEK_SET, SEEK_END, SEEK_CUR
> that seem to be useful for my purpose; however I could not find the
> method to use them.
>
> Can you give me a hint how I can append to an existing LargeObject
> (using the OutputStream interface)?
>
> Ciao
>
> Ole
>
> P.S. Is there a Java standard API documentation (javadoc-converted)
> of the extensions (es. LargeObject handling) available?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2003-08-07 02:57:37 Re: quick question about PreparedStatements
Previous Message Barry Lind 2003-08-07 02:33:10 Re: Asynchronous NOTIFY available?