Re: Difference between setObject and (setShort, setString, and so on) in PreparedStatement
- From: Arto Viitanen <arto.viitanen@xxxxxx>
- Date: Thu, 04 May 2006 09:54:57 +0300
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
.
- Follow-Ups:
- References:
- Prev by Date: Re: openning connectiosn in jdbc takes 2 minutes!!
- Next by Date: Re: Difference between setObject and (setShort, setString, and so on) in PreparedStatement
- Previous by thread: Difference between setObject and (setShort, setString, and so on) in PreparedStatement
- Next by thread: Re: Difference between setObject and (setShort, setString, and so on) in PreparedStatement
- Index(es):