Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id BCECC1E16587 for ; Tue, 10 Jan 2012 05:51:36 -0400 (AST) Received: from afrodita.rcub.bg.ac.rs ([2001:4170:0:1::120]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RkYMh-0004FG-Qt for pgsql-jdbc@postgresql.org; Tue, 10 Jan 2012 09:51:36 +0000 Received: from [IPv6:2001:4170:0:4::66] (unknown [IPv6:2001:4170:0:4::66]) by afrodita.rcub.bg.ac.rs (Postfix) with ESMTP id 161E81919FDB for ; Tue, 10 Jan 2012 10:51:20 +0100 (CET) Message-ID: <4F0C0A17.3030105@gmail.com> Date: Tue, 10 Jan 2012 10:51:19 +0100 From: Ognjen Blagojevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.25) Gecko/20111213 Thunderbird/3.1.17 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: JDBC error message for setBinaryStream Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-RCUB-MailScanner-Information: Please contact the ISP for more information X-RCUB-MailScanner-ID: 161E81919FDB.AB585 X-RCUB-MailScanner: Found to be clean X-RCUB-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-2.6, required 5, autolearn=not spam, BAYES_00 -2.60, NO_RELAYS -0.00) X-Pg-Spam-Score: -0.2 (/) X-Archive-Number: 201201/42 X-Sequence-Number: 22582 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