JDBC error message for setBinaryStream

Поиск
Список
Период
Сортировка
Искать

JDBC error message for setBinaryStream

От:
Ognjen Blagojevic <ognjen.d.blagojevic@gmail.com>
Дата:
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
FAQ