Re: Throwing NumberFormat exception for preparedStatement.setObjcet()

Поиск
Список
Период
Сортировка
От dmp
Тема Re: Throwing NumberFormat exception for preparedStatement.setObjcet()
Дата
Msg-id 4B4B8681.2080001@ttc-cmc.net
обсуждение исходный текст
Ответ на Throwing NumberFormat exception for preparedStatement.setObjcet()  (Srinivas Gunnam <srinivas_gunnam@persistent.co.in>)
Список 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.


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Throwing NumberFormat exception for preparedStatement.setObjcet()
Следующее
От: Srinivas Gunnam
Дата:
Сообщение: Re: Throwing NumberFormat exception for preparedStatement.setObjcet()