RFR: 8369432: Add Support for JDBC 4.5 MR [v3]

Lance Andersen lancea at openjdk.org
Mon Oct 13 18:26:49 UTC 2025


On Fri, 10 Oct 2025 20:13:14 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Lance Andersen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Spacing clean up in ConnectionTests
>
> src/java.sql/share/classes/java/sql/Array.java line 384:
> 
>> 382:   default void close() throws SQLException {
>> 383:     free();
>> 384:   };
> 
> The indention in this file is 4 spaces.
> Also check new close() methods in Blob, Clob and SQLXML.

fixed(SQLXML looked ok)

the joys of using different IDEs over the years

> src/java.sql/share/classes/java/sql/Connection.java line 1680:
> 
>> 1678:         throw new SQLFeatureNotSupportedException("setShardingKey not implemented");
>> 1679:     }
>> 1680:     // JDBC 4.5
> 
> Would this be information to developers if added in and @apiNote as a function in supported by JDBC 4.5.

This is just informational separation from within the interface as to where the JDBC 4.5 additions were added as had been done in previous releases.  The package-info cross references the JDBC xxx -> JDK xxx

> src/java.sql/share/classes/java/sql/Connection.java line 1747:
> 
>> 1745:      * <li>The first character is an alphabetic character from a through z, or
>> 1746:      * from A through Z</li>
>> 1747:      * <li>The name only contains alphanumeric characters or the character "_"</li>
> 
> Trailing </li> tags can be omitted to make the source more readable.  YMMV

Some tools complain(or used to anyways) if the closing tag is not provided.    So I am going to leave it for now and if/when we decide to change it, I would go through all of java.sql and probably would want to do the same for other areas of the JDK which include them.

FWIW, [www.w3schools.com](https://www.w3schools.com/tags/tag_li.asp) shows including them in their tutorial still

> src/java.sql/share/classes/java/sql/Connection.java line 1816:
> 
>> 1814:      * @param alwaysQuote indicates if a simple SQL identifier should be
>> 1815:      * returned as a quoted identifier
>> 1816:      * @return A simple SQL identifier or a delimited identifier
> 
> Is there a difference between a "quoted identifier" and a "delimited identifier"?
> The terminology should be consistent (with the jdbc spec).

A quoted identifier is a form of a delimited identifier and are often interchangeable(depending on the database).  The intent here was to be specific as some databases did not support  quotes

> src/java.sql/share/classes/java/sql/Connection.java line 1827:
> 
>> 1825:         int len = identifier.length();
>> 1826:         if (len < 1 || len > 128) {
>> 1827:             throw new SQLException("Invalid name");
> 
> The exception would be easier to debug if the identifier were included in the exception.

We talked about this during original implementation added in  JDK 9 and the feedback at the time was not to provide the name

> src/java.sql/share/classes/java/sql/Connection.java line 1829:
> 
>> 1827:             throw new SQLException("Invalid name");
>> 1828:         }
>> 1829:         if (Pattern.compile("[\\p{Alpha}][\\p{Alnum}_]*").matcher(identifier).matches()) {
> 
> In the implementation, it would save a bit of performance to do the Pattern.compile once instead of on every invocation.   ?ConstantValue or Holder class, or static.

Will look at this a part of the follow on work where we an additional internal class to host these methods which are then called by Connection/Statement as suggested by Alan

> src/java.sql/share/classes/java/sql/Connection.java line 1832:
> 
>> 1830:             return alwaysQuote ?  "\"" + identifier + "\"" : identifier;
>> 1831:         }
>> 1832:         if (identifier.matches("^\".+\"$")) {
> 
> Ditto: precompile the regex.

See above

> src/java.sql/share/classes/java/sql/Connection.java line 1835:
> 
>> 1833:             identifier = identifier.substring(1, len - 1);
>> 1834:         }
>> 1835:         if (Pattern.compile("[^\u0000\"]+").matcher(identifier).matches()) {
> 
> Could `identifier.indexOf(0)` be a more efficient way to look for an embedded null.

see above

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2426863941
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2426872970
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2426890121
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2426894289
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2426926467
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2426955825
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2426956264
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2426958129


More information about the core-libs-dev mailing list