JDBC and Blobs
JDBC and Blobs
От:
Dev <dev_hyd2001@yahoo.com>
Дата:
| Hi, I have a field in my database table of type OID which is suppose to be used to store binary data. I plan on using the setBlob and getBlob methods for storing and retrieving entries from the table. Is that the right way to proceed? If I delete a row in that table , will it delete the binary data as well from the database server? cheers /Dev |
Re: JDBC and Blobs
От:
Craig Ringer <craig@postnewspapers.com.au>
Дата:
Dev wrote: > Hi, > > I have a field in my database table of type OID which is suppose to be used to store binary data. I plan on using the setBlob and getBlob methods for storing and retrieving entries from the table. Is that the right way to proceed? If I delete a row in that table , will it delete the binary data as well from the database server? I haven't used it myself, but my understanding is that deleting the row will NOT free the associated blob. The oid is only a reference to the blob. You probably want the `lo' contrib module: http://www.postgresql.org/docs/8.3/static/lo.html -- Craig Ringer
Re: JDBC and Blobs
От:
"Albe Laurenz" <laurenz.albe@wien.gv.at>
Дата:
Dev wrote: > I have a field in my database table of type OID which is > suppose to be used to store binary data. I plan on using the > setBlob and getBlob methods for storing and retrieving > entries from the table. Is that the right way to proceed? If > I delete a row in that table , will it delete the binary data > as well from the database server? No; the best way would be to create a trigger on the table that will delete the large object if you delete (or change) the OID in the table row. This is of course only practical if the same large object is not referenced by more than one table... Yours, Laurenz Albe
Re: JDBC and Blobs
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Albe Laurenz" writes: > Dev wrote: >> If I delete a row in that table , will it delete the binary data >> as well from the database server? > No; the best way would be to create a trigger on the table that > will delete the large object if you delete (or change) the > OID in the table row. See contrib/lo rather than reinventing that wheel for yourself ... regards, tom lane
Re: JDBC and Blobs
От:
David Wall <d.wall@computer.org>
Дата:
Dev wrote:
The JDBC driver should take care of creating and deleting the underlying LO. However, with PG, the deleted LO isn't physically removed until you run contrib/vacuumlo. We include vacuumlo in our daily db maintenance routines (pg_dump, vacuum, analyze, vacuumlo).
I have a field in my database table of type OID which is suppose to be used to store binary data. I plan on using the setBlob and getBlob methods for storing and retrieving entries from the table. Is that the right way to proceed? If I delete a row in that table , will it delete the binary data as well from the database server?
David
Re: JDBC and Blobs
От:
Dev <dev_hyd2001@yahoo.com>
Дата:
| Hi all, Thanx for the responses. Looks like contrib/lo is the way to go ! cheers /Dev --- On Thu, 6/19/08, David Wall <d.wall@computer.org> wrote: From: David Wall <d.wall@computer.org> |