X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 058FB3A3BCA for ; Tue, 23 Nov 2004 05:20:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11145-07 for ; Tue, 23 Nov 2004 05:20:31 +0000 (GMT) Received: from sharp.noc24x7.com (unknown [69.56.128.138]) by svr1.postgresql.org (Postfix) with ESMTP id D7C163A2BB0 for ; Tue, 23 Nov 2004 05:20:30 +0000 (GMT) Received: from [61.3.110.135] (helo=thenilgiris.com) by sharp.noc24x7.com with esmtpa (Exim 4.43) id 1CWT6K-0005Ho-Gv; Tue, 23 Nov 2004 10:50:29 +0530 Received: from localhost (localhost [[UNIX: localhost]]) by thenilgiris.com (8.11.2/8.11.2) id iAN5Ii115030; Tue, 23 Nov 2004 10:48:44 +0530 Content-Type: text/plain; charset="iso-8859-1" From: Kenneth Gonsalves To: sreejith s , pgsql-sql@postgresql.org Subject: Re: Image Insert Postgresql DB Date: Tue, 23 Nov 2004 10:48:44 +0530 X-Mailer: KMail [version 1.2] References: <5d14ecf904112220214ec08992@mail.gmail.com> In-Reply-To: <5d14ecf904112220214ec08992@mail.gmail.com> MIME-Version: 1.0 Message-Id: <0411231048440L.01150@thenilgiris.com> Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sharp.noc24x7.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - thenilgiris.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/241 X-Sequence-Number: 19560 On Tuesday 23 November 2004 09:51 am, sreejith s wrote: > Query to insert > ---------------- > INSERT INTO Imagetable VALUES (lo_import('C:\\image\\peach.jpg')); have you succeeded in inserting an image into the database from a file on the server using the above query? AFAIK you need a bytea datatype, and also the image data has to be properly escaped (\\) before pg will accept it. I assume you are using a scripting language with a dbapi. Your steps would be: 1. read the image file into a variable 2. escape the image data 3. insert this into the database in a bytea field if you follow this procedure it is irrelevant as to where the source file is - client or server regards kg