Re: Throwing NumberFormat exception for preparedStatement.setObjcet()

From: dmp <danap(at)ttc-cmc(dot)net>
To: Srinivas Gunnam <srinivas_gunnam(at)persistent(dot)co(dot)in>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Throwing NumberFormat exception for preparedStatement.setObjcet()
Date: 2010-01-11 20:13:53
Message-ID: 4B4B8681.2080001@ttc-cmc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

>
>
> 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.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2010-01-11 20:15:28 Re: Throwing NumberFormat exception for preparedStatement.setObjcet()
Previous Message Srinivas Gunnam 2010-01-11 12:58:02 Throwing NumberFormat exception for preparedStatement.setObjcet()