Re: BLOBS : how to remove them totally

From: Nilabhra Banerjee <nil_ban(at)yahoo(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bernd Helmle <mailings(at)oopsware(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: BLOBS : how to remove them totally
Date: 2003-12-20 13:06:08
Message-ID: 20031220130608.63654.qmail@web25002.mail.ukl.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks a lot for the clue... Now I am comfortably
handling the Lrge Objects thru SQL...

But unfortunately I could not extract this data to
frontend thru java... I tried in two ways but got the
same error...after getting the data in Blob or Large
Object.

Error in connection == FastPath call returned ERROR:
invalid large-object descriptor: 0

1) Process One
Blob myBlob = null;
Then for resultset rs
myBlob=rs.getBlob(1);

The error is returned in any statement which processes
the Blob object like,
long myLength = myBlob.length();

2) Process Two
FIRST the largeobject manager
LargeObjectManager lobj =
((org.postgresql.PGConnection)conn).getLargeObjectAPI();
THEN in the while rs.next() loop
LargeObject obj = lobj.open(oid,
LargeObjectManager.READ);
AND THEN
InputStream input = new
BufferedInputStream(largeobj.getInputStream());

THe Error is returned in any statement that processes
the input like writing in a ouputstream
int b = -1;
while ((b = input.read()) != -1)
outputStream.write(b);

I AM PUZZLED... WHERE IS THE WRONG ? THE CODE IS NOT
COMPLAINING WHEN I GET THE VALUE FROM THE RESULT IN A
OBJECT. BUT IT IS GIVING ERROR WHEN I AM TRYING TO
READ THE OBJECT.

Regards
Nilabhra Banerjee

--- Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote: > Bernd Helmle
<mailings(at)oopsware(dot)de> writes:
> > Here you can find an excellent description, how
> BLOBs in PostgreSQL can
> > be handled:
> > http://www.varlena.com/varlena/GeneralBits/44.php
>
> That's a good discussion, but it left out at least
> one useful bit of
> info about managing large objects: there's a contrib
> utility
> (contrib/vacuumlo) that can find and remove large
> objects that are not
> referenced anywhere in the database. This is a good
> way to clean up
> if you've been using large objects without any of
> the automatic
> management techniques suggested in the GeneralBits
> article.
>
> regards, tom lane
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
> subscribe-nomail command to
> majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list
cleanly

________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shridhar Daithankar 2003-12-20 13:20:16 Re: MySQL Gets Functions in Java - Enlightenment Please
Previous Message Shridhar Daithankar 2003-12-20 13:05:17 Re: MySQL Gets Functions in Java - Enlightenment Please