Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9C060659E4B for ; Wed, 13 Jan 2010 19:12:10 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 94144-02-5 for ; Wed, 13 Jan 2010 23:11:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 5610B65A064 for ; Wed, 13 Jan 2010 18:36:54 -0400 (AST) Received: by leary.csoft.net (Postfix, from userid 1112) id 76E4FA39C; Wed, 13 Jan 2010 17:36:52 -0500 (EST) Date: Wed, 13 Jan 2010 17:36:52 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Dave Cramer cc: Srinivas Gunnam , "pgsql-jdbc@postgresql.org" Subject: Re: Throwing NumberFormat exception for preparedStatement.setObjcet() In-Reply-To: <491f66a51001120345o78aa2597n3c9f7f281a57baed@mail.gmail.com> Message-ID: References: <14B8F27D7CE40C4C9E481B2B845C2E0D724677A2@EXCHANGE.persistent.co.in> <491f66a51001111215l5ef09181j288d4d583bf007e4@mail.gmail.com> <14B8F27D7CE40C4C9E481B2B845C2E0D72467E0F@EXCHANGE.persistent.co.in> <491f66a51001120345o78aa2597n3c9f7f281a57baed@mail.gmail.com> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-278976125-1263422212=:3231" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.537 tagged_above=-10 required=5 tests=AWL=0.062, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201001/10 X-Sequence-Number: 20206 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-278976125-1263422212=:3231 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Tue, 12 Jan 2010, Dave Cramer wrote: > If I were writing it I would use java.sql.Types.Integer as the > columnType, not the numeric value. And inputData should be an Integer. > inputData can perfectly well be a String. That's the whole point of the three argument version of this method, to provide such a conversion for the user. The reason it's throwing a NumberFormatException is that you're passing something which isn't a number. With a later driver version you wouldn't get this exception, but instead the server would complain that it wasn't a valid number. The attached test case shows this working just fine from my perspective. Kris Jurka --0-278976125-1263422212=:3231 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=SetObjectTest.java Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=SetObjectTest.java aW1wb3J0IGphdmEuc3FsLio7DQoNCnB1YmxpYyBjbGFzcyBTZXRPYmplY3RU ZXN0IHsNCg0KCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZyBhcmdz W10pIHRocm93cyBFeGNlcHRpb24gew0KCQlDbGFzcy5mb3JOYW1lKCJvcmcu cG9zdGdyZXNxbC5Ecml2ZXIiKTsNCg0KCQlDb25uZWN0aW9uIGNvbm4gPSBE cml2ZXJNYW5hZ2VyLmdldENvbm5lY3Rpb24oImpkYmM6cG9zdGdyZXNxbDov L1s6OjFdOjU0MzIvanVya2EiLCAianVya2EiLCAiIik7DQoNCgkJU3RhdGVt ZW50IHN0bXQgPSBjb25uLmNyZWF0ZVN0YXRlbWVudCgpOw0KCQlzdG10LmV4 ZWN1dGUoIkNSRUFURSBURU1QIFRBQkxFIHNvdChhIGludCkiKTsNCgkJc3Rt dC5jbG9zZSgpOw0KDQoJCVByZXBhcmVkU3RhdGVtZW50IHBzID0gY29ubi5w cmVwYXJlU3RhdGVtZW50KCJJTlNFUlQgSU5UTyBzb3QgVkFMVUVTICg/KSIp Ow0KDQoJCXBzLnNldE9iamVjdCgxLCAiMSIsIDMpOw0KCQlwcy5leGVjdXRl VXBkYXRlKCk7DQoNCgkJcHMuc2V0T2JqZWN0KDEsICJBIiwgMyk7DQoJCXBz LmV4ZWN1dGVVcGRhdGUoKTsNCg0KCQlwcy5jbG9zZSgpOw0KCQljb25uLmNs b3NlKCk7DQoJfQ0KDQp9DQoNCg== --0-278976125-1263422212=:3231--