JDBC improvements and convenience method suggestions

Lance Andersen lance.andersen at oracle.com
Fri Jul 13 18:28:10 UTC 2018

> On Jul 13, 2018, at 6:44 AM, Lukas Eder <lukas.eder at gmail.com> wrote:
>> Lukas>but this is already the case today, and it is really more of an
>> implementation problem than an API specification problem
>> Lukas> it should be totally possible to call
>> Lukas>    pstmt.setObject(1, null);
>> Please check javadoc for that method. There's an explicit advice there to
>> use `setNull` for maximal portability. Not all the databases support
>> untyped nulls.
> So Ctrl+C / Ctrl+V to the new method, right? I mean, it's clear that my
> suggestion is not maximally portable. Neither is setObject(). Yet, e.g. in
> order to pass JSR-310 types, we have to use setObject() now.

During the JDBC 1.x days it made sense to continue to add setXXX, getXXX, updateXXX, due to early JDK performance (circa 1996 et al)

The performance of setObject(int parameterIndex, Object x, int sqlType) is more than adequate these days.

We talked in the EG about  whether there is a need to add specific setters and getters and just did not see the benefit

 <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>

More information about the jdbc-spec-discuss mailing list