Re: Problem while using lo_import and lo_export

From: "Aaron Bono" <postgresql(at)aranya(dot)com>
To: Rodrigo De León <rdeleonp(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problem while using lo_import and lo_export
Date: 2006-08-03 04:05:07
Message-ID: bf05e51c0608022105l4d7424eei7f4224e549f5c847@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 8/2/06, Rodrigo De León <rdeleonp(at)gmail(dot)com> wrote:
>
> On 8/2/06, Aaron Bono <postgresql(at)aranya(dot)com> wrote:
> > On 8/2/06, Penchalaiah P. <penchalaiahp(at)infics(dot)com> wrote:
> > > Hi,
> > >
> > > I have PostgresSQL database connection from server. Server ip is
> > 172.16.5.179
> > >
> > > Now I want use lo_import and lo_export function for storing images
> into
> > the database.
> > >
> > > This images is located in my system itself.
> > >
> > > When I am going using the following query…
> > >
> > > Insert into image
> > values('chanukya',lo_import('D:/Vivek/Personal/PICS/IN/chanukya.jpg'))
> > >
> > > ….it rises error 'no such file or directory'
> >
> > Looks like you are running on a Windows machine. Did you try:
> >
> > Insert into image
> > values('chanukya',lo_import('D:\Vivek\Personal\PICS\IN\chanukya.jpg'));
> >
> > Windows uses \, not /. I am not sure if PostgreSQL will translate for
> you
> > like Java does.
>
> I believe PostgreSQL accepts slashes as a separator on Win32 (I used
> it that way with COPY), but if you want to use backslashes, you have
> to escape them:
>
> INSERT INTO IMAGE
> VALUES ('chanukya',
> lo_import('D:\\Vivek\\Personal\\PICS\\IN\\chanukya.jpg'));
>
> Also, I'm not sure if Penchalaiah means that "Server" = "my system
> itself", double check on that.

Good point. I presume that PostgreSQL will look at the path relative to the
server, not the client. I personally keep my files in CVS and just put
references to the files in PostgreSQL. Of course, I had to write the code
that automatically checks the files into CVS but it works quite well.

==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
==================================================================

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Hammond 2006-08-03 16:16:29 Re: SELECT all fields except two
Previous Message Rodrigo De León 2006-08-03 01:33:34 Re: Problem while using lo_import and lo_export