pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dmp <danap@ttc-cmc.net>
To: Srinivas Gunnam <srinivas_gunnam@persistent.co.in>
To: pgsql-jdbc@postgresql.org
Subject: Re: Throwing NumberFormat exception for preparedStatement.setObjcet()
Date: Mon, 11 Jan 2010 13:13:53 -0700
Message-ID: <4B4B8681.2080001@ttc-cmc.net> (raw)
In-Reply-To: <14B8F27D7CE40C4C9E481B2B845C2E0D724677A2@EXCHANGE.persistent.co.in>
References: <14B8F27D7CE40C4C9E481B2B845C2E0D724677A2@EXCHANGE.persistent.co.in>

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




view thread (7+ messages)  latest in thread

Message-ID: <4B4B8681.2080001@ttc-cmc.net>
Permalink:  ../4B4B8681.2080001@ttc-cmc.net/
Also on:    postgresql.org/message-id/4B4B8681.2080001@ttc-cmc.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: danap@ttc-cmc.net, srinivas_gunnam@persistent.co.in
  Subject: Re: Throwing NumberFormat exception for preparedStatement.setObjcet()
  In-Reply-To: <4B4B8681.2080001@ttc-cmc.net>
  References: <14B8F27D7CE40C4C9E481B2B845C2E0D724677A2@EXCHANGE.persistent.co.in> <4B4B8681.2080001@ttc-cmc.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox