Re: A Question about Large Object - Mailing list pgsql-interfaces

From Rudolf ter Haar
Subject Re: A Question about Large Object
Date
Msg-id 383A895C.CB66D4C1@dutw38.wbmt.tudelft.nl
Whole thread Raw
In response to A Question about Large Object  (Juan Colmenares <juancol@luz.ve>)
List pgsql-interfaces
Hi Juan,

I have nearly the same problem as you seem to have.
I am able to store and retrieve files in a PostgreSQL database.
However i only can save and get files wich are on the Linux box where my
postgres server is running.
Is this the case with your problem too ??

Anyway if i tell my visual basic application that it has to store and
retrieve files on the PC (running windows) than i don't have success.
Saving files at the Linux box is no problem.

I do it the following way

This is the SQL statement in the ODBC string.  (exporting data on the linux
machine)
  SELECT lo_export(juancol.photo,'/tmp/photo')  FROM juancol juancol  WHERE
(juancol.name='nicephoto');


(importing data from the linux machine)

INSERT INTO juancol (juancol.name, juancol.photo)  VALUES ('nicephoto',
lo_import('/usr2/terhaar/photo.jpg'));

I think it is a good idea to work with a unique key to get the photo and to
store the photo, so that we do not get misunderstandings.


Do not forget to think of setting open the directory for writing, with chmod
xxx or something.
I hope this will work for you .

Anyway my problem is that i can not write or read to a PC directly..
Did you solve this with psql ???

Kind regards

Rudolf ter Haar.





Juan Colmenares wrote:

> Hello.
>
> I'm trying to store a jpeg file into a table created as follow:
>
> CREATE TABLE juancol (
> name            text,
> photo           oid
> );
>
> I can insert a jpeg file from pgsql (locally) but I can not do this from
> an
> application written in Visual Basic using an ODBC driver (V06-40-0006).
>
> I read psqlodbc FAQs (Can I use large objects or OLE?) but I wouldn't
> have to deal with clean-up tasks.
>
> Someone could tell me any suggestion?
>
> Thanks in advance!
>
> Juan Andres.



pgsql-interfaces by date:

Previous
From: "Rafal Piotrowski (CSCS)"
Date:
Subject: LargeObject.write(byte[] buf) method
Next
From: Peter Mount
Date:
Subject: Re: [INTERFACES] problem with getBytes