From: francescoboccacci@libero.it <francescoboccacci@libero.it>
To: pgsql-admin@postgresql.org
Subject: Import image into postgresql database
Date: Fri, 1 Jul 2011 12:13:33 +0200 (CEST)
Message-ID: <8011192.5657131309515213054.JavaMail.defaultUser@defaultHost> (raw)
Dear all,
i have a question for you: I would like to store images (jpg) into a table of
postgresql database. My question is : what is the corret type of tables filed
that i have to use? Reading some forum of article in the net there are two
ways: bytea or oid type. Whati is the best type to store my images?
I tried to insert in both ways. With oid type i able to insert images, but
with bytea i don't understand how store it .
i create a test table:
CREATE TABLE public.images
(
imgname text,
img bytea
)
and i tried many ways:
NSERT INTO images (imgname, img)
VALUES ('beautiful image', bytea_import('C:\\9999.jpg'));
or
INSERT INTO images (img) VALUES (pg_escape_bytea('C:\\9999.jpg'))
but it doesn't work.
So How can i solve my problem? and another question.. If i able to store my
image into bytea fiels..how can i export it for see it for example with paint?
Thanks
Francesco Boccacci
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: francescoboccacci@libero.it
Subject: Re: Import image into postgresql database
In-Reply-To: <8011192.5657131309515213054.JavaMail.defaultUser@defaultHost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox