pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Huttleston Jr <dhjr@hddesign.com>
To: pgsql-interfaces@postgresql.org
Subject: Re: wrong documentation and others .....
Date: Fri, 6 Oct 2000 17:58:37 -0500
Message-ID: <200010062258.RAA03305@proxy.hddesign.com> (raw)
In-Reply-To: <39DC5F29.E9F4023@dif.um.es>

Hi Gabriel,
	We have been using the postgresql JDBC to serialize classes and have
had no problems since we figured out that the doc's are wrong.  I had
to find answers in the source code.
	I've attached a class called Shelf which serializes any java object to a
table.  Within the code is the schema of a table called tbl_objectshelf which
is suitable as a "shelf". I hope this saves you some time.

	Have fun,
		Dave

On Thu, 05 Oct 2000 12:59:53 +0200, you wrote:
> 
> 
>     Hi all.
> 
>     I have several days working with LargeObject and postgres 7.0.2 and
> I have found many problems. In the first time the postgresql doc is
> wrong, in chapter 58 of PosgreSQL tutorial (JDBC Interfaces) it repot
> who to work with Large Object and give code that is wrong:
> 
>         File file = new File("myimage.gif");
>         FileInputStream fis = new FileInputStream(file);
>         PreparedStatement ps = conn.prepareStatement("insert into images
> values (?,?)");
>         ps.setString(1,file.getName());
>         ps.setBinaryStream(2,fis,file.length());
>         ps.executeUpdate();
>         ps.close();
>         fis.close();
> 
>         PreparedStatement ps = con.prepareStatement("select oid from
> images where name=?");
>         ps.setString(1,"myimage.gif");
>         ResultSet rs = ps.executeQuery();
>         if(rs!=null) {
>             while(rs.next()) {
>                 InputStream is = rs.getBinaryInputStream(1);
>                 // use the stream in some way here
>                 is.close();
>                 }
>             rs.close();
>         }
>         ps.close();
> 
> 
>         InputStream ARE NOT SUPPORTED in JDBC implementation ¡¿?¡ and
> "getBinaryInputStream()" really is "getBinaryStream()".  I think that it
> is very serious. The other method (that I know) is using LargeObjectAPI,
> but this fail every 9 times of PreparedStatement of setObject() sentence
> ¡¡¡ and when use LargeObjectManager as in source examples. (I send other
> messages to list)
> 
> 
>         Has PostgreSQL any way to work WELL with LargeObject.?
> 
>     Please reply me.
> 
>     Cheers, Gabi.
> 
> 
> --
> Gabriel López Millán
> Facultad de Informática -Universidad de Murcia
> 30001 Murcia - España (Spain)
> Telf: +34-968-364644 E-mail: gabilm@dif.um.es
> 
> 
> 
> 

Attachments:

  Shelf.java (application/octet-stream, 3.0K) download

view thread (15+ messages)  latest in thread

Message-ID: <200010062258.RAA03305@proxy.hddesign.com>
Permalink:  ../200010062258.RAA03305@proxy.hddesign.com/
Also on:    postgresql.org/message-id/200010062258.RAA03305@proxy.hddesign.com

 · 

reply

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-interfaces@postgresql.org
  Cc: dhjr@hddesign.com
  Subject: Re: wrong documentation and others .....
  In-Reply-To: <200010062258.RAA03305@proxy.hddesign.com>

* 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