Re: Difference between setObject and (setShort, setString, and so on) in PreparedStatement



ahjiang@xxxxxxxxx wrote:
Hi all,

I would like to know what is the difference between the methods
setObject and (setShort, setString, and so on) in PreparedStatement
object.

When should we specifically use the setShort setString methods instead
of setObject ?


You use setObject on cases where the database system has some specific
datatype which is not known to JDBC, like INET for network addresses
in PostgreSQL. Since most database systems support character and number
data, JDBC has predefined setString and setShort methods. If your
database system supports user defined types, you might need to use
SQLData interface instead.

--
Arto Viitanen, CSC Ltd.
Espoo, Finland
.