Skip to content

Commit 3a0fa81

Browse files
committed
#913 FBDatabaseMetaData.getMinorVersion() should report 4 (for JDBC 4.4) on Java 24 and higher
1 parent f1762b1 commit 3a0fa81

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/main/org/firebirdsql/jdbc/FBDatabaseMetaData.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,16 @@ private CatalogMetadataInfo getCatalogMetadata() {
20262026
}
20272027

20282028
private static final int JDBC_MAJOR_VERSION = 4;
2029-
private static final int JDBC_MINOR_VERSION = 3;
2029+
private static final int JDBC_MINOR_VERSION = determineJDBCMinorVersion();
2030+
2031+
private static int determineJDBCMinorVersion() {
2032+
if (Runtime.version().feature() >= 24) {
2033+
// Java 24 and higher: JDBC 4.4
2034+
return 4;
2035+
}
2036+
// Assume Java 9 - 23: JDBC 4.3
2037+
return 3;
2038+
}
20302039

20312040
@Override
20322041
public int getJDBCMajorVersion() {

src/test/org/firebirdsql/jdbc/FBDatabaseMetaDataTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,8 @@ void testGetJDBCMajorVersion() throws Exception {
759759

760760
@Test
761761
void testGetJDBCMinorVersion() throws Exception {
762-
assertEquals(3, dmd.getJDBCMinorVersion(), "JDBCMinorVersion");
762+
final int expectedMinor = Runtime.version().compareTo(Runtime.Version.parse("24")) >= 0 ? 4 : 3;
763+
assertEquals(expectedMinor, dmd.getJDBCMinorVersion(), "JDBCMinorVersion");
763764
}
764765

765766
/**

0 commit comments

Comments
 (0)