pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ognjen Blagojevic <ognjen.d.blagojevic@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: JDBC error message for setBinaryStream
Date: Tue, 10 Jan 2012 10:51:19 +0100
Message-ID: <4F0C0A17.3030105@gmail.com> (raw)

Hi,

Yesterday I spent some time making JDBC driver to work, and I believe 
that better error message could save some time for other developers 
having the same problem.

I was struggling with method

   preparedStatement.setBinaryStream(2, inputStream, file.length())

which resulted in "Not implemented exception". After a while I realized 
that there are two methods:

   setBinaryStream(int, InputStream, int)
   setBinaryStream(int, InputStream, long)

Where the first one is implemented and the second one is not. Adding to 
the fact that file.length() returns long, so a user saving file to the 
database will most probably hit same exception.

While the second method is still unimplemented, IMHO it should return 
more helpful exception message like:

   "Not implemented yet. If the stream size fits integer value, you may 
use setBinaryStream(int, InputStream, int) instead.".

Other users seems to have the same problem [1][2].

-Ognjen

[1] http://archives.postgresql.org/pgsql-bugs/2007-05/msg00106.php
[2] 
http://stackoverflow.com/questions/4299765/saving-java-object-to-postgresql-problem



Message-ID: <4F0C0A17.3030105@gmail.com>
Permalink:  ../4F0C0A17.3030105@gmail.com/
Also on:    postgresql.org/message-id/4F0C0A17.3030105@gmail.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: ognjen.d.blagojevic@gmail.com
  Subject: Re: JDBC error message for setBinaryStream
  In-Reply-To: <4F0C0A17.3030105@gmail.com>
  References: <4F0C0A17.3030105@gmail.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