Re: How to save a image file in a postgres data field.

From: "Obe, Regina" <robe(dot)dnd(at)cityofboston(dot)gov>
To: "PostgreSQL Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: How to save a image file in a postgres data field.
Date: 2008-08-28 22:01:16
Message-ID: 53F9CF533E1AA14EA1F8C5C08ABC08D20197A1BC@ZDND.DND.boston.cob
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


You can do bytea (which stores the image as a bytearray) or Large Object support (lo) which stores the oid reference to the image and stores it in another table.

What language are you using? Check way at the bottom of this page gives an example of storing files in bytea using .NET ADO driver as well as using the LO (Large Object support).

Even if its not the language you use, could provide you with some ideas.

Bytea example Look for "Working with binary data and bytea datatype"
For LO look for "Working with large object support" in the below link
http://npgsql.projects.postgresql.org/docs/1.0/manual/UserManual.html

Hope that helps,
Regina

-----Original Message-----
From: pgsql-novice-owner(at)postgresql(dot)org on behalf of richard terry
Sent: Thu 8/28/2008 5:26 PM
To: 'PostgreSQL Novice'
Subject: [NOVICE] How to save a image file in a postgres data field.

I want to be able to save an image, say myimage.png, into the database, and
having difficulty with understanding the postgres documentation.

The nearest I can figure is that there is a field called bytea ?? is this the
correct one.

If so, I wondered if anyone could give me a simple line of sql code which
would demonstrate how to do this.

Regards and thanks in advance.

Richard

--
Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Dale Seaburg 2008-08-30 21:49:37 Date Of Entry and Date Of Change
Previous Message richard terry 2008-08-28 21:26:06 How to save a image file in a postgres data field.