pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-jdbc@postgresql.org
Cc: Brad Milne <mail_4brad@yahoo.co.uk>
Subject: Re: BLOB help - yes I've read around!
Date: Tue, 7 Apr 2009 16:21:28 +0200
Message-ID: <200904071721.28357.achill@matrix.gatewaynet.com> (raw)
In-Reply-To: <49DB5D63.5040103@yahoo.co.uk>
References: <49DB559F.3030805@yahoo.co.uk>
	<200904071657.08065.achill@matrix.gatewaynet.com>
	<49DB5D63.5040103@yahoo.co.uk>

Στις Tuesday 07 April 2009 17:04:19 ο/η Brad Milne έγραψε:
> Thanks Achilleas
> 
> So how do you save the bytea data? I get:
> Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setBinaryStream(int, 
> InputStream) is not yet implemented
> 

I never worked with JDK 1.6 and JDBC4, 
from http://jdbc.postgresql.org/download.html we see:
"Support for JDBC4 methods is limited. The driver builds, but the majority of new methods are stubbed out."
i dont know if that is relevant, i just saw the "jdbc4" part in your org.postgresql.jdbc4.Jdbc4PreparedStatement.setBinaryStream

Having said that, i usually call setBytes.

> 
> 
> Achilleas Mantzios wrote:
> > Στις Tuesday 07 April 2009 16:31:11 ο/η Brad Milne έγραψε:
> >   
> >> Hi all
> >>
> >> I'm a Java dev, new to postgres. I've just migrated an app during 
> >> development from Derby to Postgres (due to better indexing features), 
> >> but am very confused by the failing BLOB implementations.
> >>
> >> PostgreSQL: 8.3.7
> >> PostgreSQL-JDBC: 8.3-604
> >> JDK: 6
> >>
> >> A lot of what I've seen in searches and even in the google groups page, 
> >> seems to be related to older jdbc drivers, where BLOBs were supported, 
> >> both for OID and bytea. I'm currently getting 'unimplemented' exceptions 
> >> doing anything with BLOBs.
> >>
> >> My application saves sound files as byte arrays to the database.
> >>
> >> Q1: Given that it's sound and not text, would it be safe to use bytea 
> >> given that certain characters need to be escaped?
> >>     
> >
> > I have been storing binary data in bytea for ages with postgresql,
> > with no major problems.
> > Performance might be an issue.
> > It is a good practice to store along with the bytea value,
> > its mime type as well.
> > So in your binary library you could have mp3s,oggs,mpegs, ms docs, jpegs, pdfs,
> > and your servlet would know exactly the content type to serve to the client.
> >
> > Also to answer your question about safeness/escaping, etc...
> > those are taken care by the jdbc driver.
> >
> >   
> >> Q2: How on earth do I use the BLOB methods? In particular setBlob(int 
> >> parameterIndex, InputStream inputStream) and/or createBlob() and 
> >> setBlob(int parameterIndex, Blob x)?
> >>
> >>     
> >
> > I never did anything with BLOBs so no experience from me here.
> >
> >   
> >> Thanks a lot
> >> Brad
> >>
> >>     
> >
> >
> >
> >   
> 
> 



-- 
Achilleas Mantzios



view thread (10+ messages)  latest in thread

Message-ID: <200904071721.28357.achill@matrix.gatewaynet.com>
Permalink:  ../200904071721.28357.achill@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/200904071721.28357.achill@matrix.gatewaynet.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: achill@matrix.gatewaynet.com, mail_4brad@yahoo.co.uk
  Subject: Re: BLOB help - yes I've read around!
  In-Reply-To: <200904071721.28357.achill@matrix.gatewaynet.com>
  References: <49DB559F.3030805@yahoo.co.uk> <200904071657.08065.achill@matrix.gatewaynet.com> <49DB5D63.5040103@yahoo.co.uk> <200904071721.28357.achill@matrix.gatewaynet.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