Repository navigation
JDBC metadata reports java.lang.Object for IPv4 and IPv6 column class names #3189
Copy link
Copy link
Open
Labels
area:jdbc-metadataissue handling metadata things like getting type of columnissue handling metadata things like getting type of columnbugjdbc-v2jdbc-v2 issuesjdbc-v2 issues
Description
Description
ResultSetMetaData#getColumnClassName() reports java.lang.Object for ClickHouse IPv4 and IPv6 columns.
However, ResultSet#getObject() correctly returns java.net.Inet4Address and java.net.Inet6Address, respectively.
Therefore, the metadata class name appears to be inconsistent with the actual Java type returned by the driver.
Steps to reproduce
- Create a table containing
IPv4andIPv6columns. - Insert IPv4 and IPv6 values.
- Execute a
SELECT. - Inspect
ResultSetMetaData#getColumnClassName(). - Inspect the runtime classes returned by
ResultSet#getObject().
Error Log or Exception StackTrace
No exception is thrown. The issue is an incorrect JDBC metadata value.
Column: ipv4_col
Column type name: IPv4
JDBC type: 1111 (Types.OTHER)
Column class name: java.lang.Object
Column: ipv6_col
Column type name: IPv6
JDBC type: 1111 (Types.OTHER)
Column class name: java.lang.Object
The actual objects returned by ResultSet#getObject() are:
class java.net.Inet4Address
class java.net.Inet6Address
Expected Behaviour
ResultSetMetaData#getColumnClassName() should report the Java class actually returned by ResultSet#getObject():
IPv4 -> java.net.Inet4Address
IPv6 -> java.net.Inet6Address
Specifically:
ipv4_col:
getColumnTypeName() -> IPv4
getColumnType() -> Types.OTHER
getColumnClassName() -> java.net.Inet4Address
ipv6_col:
getColumnTypeName() -> IPv6
getColumnType() -> Types.OTHER
getColumnClassName() -> java.net.Inet6Address
Code Example
ResultSet rs = statement.executeQuery(
"SELECT ipv4_col, ipv6_col FROM data_types_test_table"
);
ResultSetMetaData metadata = rs.getMetaData();
for (int i = 1; i <= metadata.getColumnCount(); i++) {
System.out.println("Column: " + metadata.getColumnName(i));
System.out.println("Type name: " + metadata.getColumnTypeName(i));
System.out.println("JDBC type: " + metadata.getColumnType(i));
System.out.println("Class name: " + metadata.getColumnClassName(i));
}
rs.next();
Object ipv4 = rs.getObject("ipv4_col");
Object ipv6 = rs.getObject("ipv6_col");
System.out.println(ipv4.getClass());
System.out.println(ipv6.getClass());Output:
Column: ipv4_col
Type name: IPv4
JDBC type: 1111
Class name: java.lang.Object
Column: ipv6_col
Type name: IPv6
JDBC type: 1111
Class name: java.lang.Object
class java.net.Inet4Address
class java.net.Inet6Address
Configuration
Client Configuration
No non-default client configuration is required to reproduce the issue.
I just created a dumb table with 2 ip columns.
Environment
- Cloud
- Client version:
0.10.0(jdbc driver version) - Language version: Java 17
- OS: macOS / Windows
ClickHouse Server
- ClickHouse Server version:
clickhouse/clickhouse-server:26.9.11.2-distroless(docker image) - ClickHouse Server non-default settings, if any: None
CREATE TABLEstatements for tables involved:
CREATE TABLE data_types_test_table
(
ipv4_col IPv4,
ipv6_col IPv6
)
ENGINE = MergeTree
ORDER BY tuple();- Sample data for all these tables:
INSERT INTO data_types_test_table
(
ipv4_col,
ipv6_col
)
VALUES
(
'10.0.0.1',
'2001:db8::1'
);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:jdbc-metadataissue handling metadata things like getting type of columnissue handling metadata things like getting type of columnbugjdbc-v2jdbc-v2 issuesjdbc-v2 issues
Activity
chernser commentedon Oct 7, 2026
@ventod
Thank you for reporting this!