JDBC error message for setBinaryStream

From: Ognjen Blagojevic <ognjen(dot)d(dot)blagojevic(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: JDBC error message for setBinaryStream
Date: 2012-01-10 09:51:19
Message-ID: 4F0C0A17.3030105@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Browse pgsql-jdbc by date

  From Date Subject
Next Message Christian Ullrich 2012-01-10 13:07:10 Patch: Platform-independent SSPI authentication support
Previous Message Stefan Keller 2012-01-10 06:26:14 Re: [JDBC] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues