Re: How to save a image file in a postgres data field. - Mailing list pgsql-novice

From Obe, Regina
Subject Re: How to save a image file in a postgres data field.
Date
Msg-id 53F9CF533E1AA14EA1F8C5C08ABC08D20197A1BC@ZDND.DND.boston.cob
Whole thread Raw
In response to How to save a image file in a postgres data field.  (richard terry <rterry@gnumed.net>)
Responses Re: How to save a image file in a postgres data field.
List 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@postgresql.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@postgresql.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.


Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper.

pgsql-novice by date:

Previous
From: richard terry
Date:
Subject: How to save a image file in a postgres data field.
Next
From: Dale Seaburg
Date:
Subject: Date Of Entry and Date Of Change