Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 5DE116332A3 for ; Mon, 11 Jan 2010 16:29:49 -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 93898-09 for ; Mon, 11 Jan 2010 20:29:29 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outbound.vnet-inc.com (outbound.vnet-inc.com [216.146.104.103]) by mail.postgresql.org (Postfix) with ESMTP id B8E536332AF for ; Mon, 11 Jan 2010 16:29:32 -0400 (AST) Received: from [192.168.157.32] (unknown [216.129.226.144]) by outbound.vnet-inc.com (Postfix) with ESMTP id D51925AB2; Mon, 11 Jan 2010 13:29:30 -0700 (MST) Message-ID: <4B4B8681.2080001@ttc-cmc.net> Date: Mon, 11 Jan 2010 13:13:53 -0700 From: dmp User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060417 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Srinivas Gunnam , pgsql-jdbc@postgresql.org Subject: Re: Throwing NumberFormat exception for preparedStatement.setObjcet() References: <14B8F27D7CE40C4C9E481B2B845C2E0D724677A2@EXCHANGE.persistent.co.in> In-Reply-To: <14B8F27D7CE40C4C9E481B2B845C2E0D724677A2@EXCHANGE.persistent.co.in> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.334 tagged_above=-10 required=5 tests=AWL=0.265, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201001/7 X-Sequence-Number: 20203 > > > Hi, > > In our application we are using the Postgres Sql 8.3.3 and jdbc driver > is postgresql-8.0-310.jdbc3. > > When I am trying to set the value for id(int) like as follows > throwing exception. > ps.setObject(1, inputData,columntype); > where inputdate value is 2 > if I modified the above statement like as follows then it works fine. > ps.setObject(1, inputData); > I want to know what could be the proble. > > Thanks, > > Srinvias It looks like you to me off hand that the targetSqlType may possibly not be a ROWID per the documentation. Also maybe check that value, columntype, to insure matches. =================================================================== setObject void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException Sets the value of the designated parameter with the given object. This method is like the method setObject above, except that it assumes a scale of zero. Parameters: parameterIndex - the first parameter is 1, the second is 2, ... x - the object containing the input parameter value targetSqlType - the SQL type (as defined in java.sql.Types) to be sent to the database Throws: SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement SQLFeatureNotSupportedException - if targetSqlType is a ARRAY, BLOB, CLOB, DATALINK, JAVA_OBJECT, NCHAR, NCLOB, NVARCHAR, LONGNVARCHAR, REF, ROWID, SQLXML or STRUCT data type and the JDBC driver does not support this data type See Also: Types =================================================================== danap.