RFR: 8369432: Add Support for JDBC 4.5 MR [v3]
Roger Riggs
rriggs at openjdk.org
Fri Oct 10 20:51:14 UTC 2025
On Fri, 10 Oct 2025 17:25:34 GMT, Lance Andersen <lancea at openjdk.org> wrote:
>> This PR adds support for the upcoming JDBC 4.5 MR which provides the following updates to the JDBC specification:
>>
>> - Deprecate SQLPermission for removal
>> - Enhance the Blob/Clob/Array/SQLXML/NClob interfaces to extend/support AutoClosable
>> - Add the SQL types DECFLOAT, JSON to Types.Java and JDBCType.java
>> - Add the quoted identifier methods that **were added previously to the Statement interface in JDK 9** to the Connection interface
>> - It is the exact same verbiage & default methods used when these methods were added to the Statement interface
>> - Clarify the Timestamp::hashCode method which incorrectly indicates that nanos are not used when calculating the hash
>>
>> Tiers 1-3 have been run
>
> 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.
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.
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
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).
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.
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.
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.
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2421996228
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2422007116
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2422018714
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2422014939
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2422015965
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2422027684
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2422030143
PR Review Comment: https://git.openjdk.org/jdk/pull/27693#discussion_r2422033151
More information about the core-libs-dev
mailing list