From: | Ognjen Blagojevic <ognjen(at)etf(dot)bg(dot)ac(dot)yu> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Newbie question about blobs and bytea |
Date: | 2010-02-08 09:02:47 |
Message-ID: | 4B6FD337.5000003@etf.bg.ac.yu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Mary Anderson wrote:
> I have read the stuff on blobs and bytea columns many time in the
> past few years , but just do not get it. I have short files, stored on
> the operating system as - say - pdf files. Can I store the content of
> one of these files in a bytea column? If I do, how do I store and
> retrieve the file for display on the screen? If I do this in a bytea
> column do I need to escape anything?
1. You may store your files in the bytea columns.
2. Retrieval depends on several things: what front end you use for
retrieval, and how do you intend to display files. For instance, if you
are using JDBC driver, you may read the files into the Java byte[]
variable using regular SELECT statement. If you plan to display your PDF
files inside a web application, you may then use a servlet, to create
HTTP response to the user. The user agent will interpret the response
and open a PDF file.
3. Again, escaping depends on your front end. Most probably the driver
will do the escaping for you, you will just read and write arrays of
bytes, similar to reading and writing files on the file system.
Regards,
Ognjen
From | Date | Subject | |
---|---|---|---|
Next Message | Krešimir Križanović | 2010-02-08 09:40:57 | Re: trouble with an older version of postgresql |
Previous Message | James Long | 2010-02-08 07:57:45 | Re: Novice PL/pgSQL question and example |