Skip to content

JDBC metadata reports java.lang.Object for IPv4 and IPv6 column class names #3189

Open

Description

@ventod

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

  1. Create a table containing IPv4 and IPv6 columns.
  2. Insert IPv4 and IPv6 values.
  3. Execute a SELECT.
  4. Inspect ResultSetMetaData#getColumnClassName().
  5. 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 TABLE statements 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'
);

Activity

  1. added this to the 0.12.0 milestone on Oct 7, 2026
  2. added
    jdbc-v2jdbc-v2 issues
    area:jdbc-metadataissue handling metadata things like getting type of column
    on Oct 7, 2026
  3. chernser commented on Oct 7, 2026

    @chernser
    Contributor

    @ventod

    Thank you for reporting this!

  4. removed this from the 0.12.0 milestone on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:jdbc-metadataissue handling metadata things like getting type of columnbugjdbc-v2jdbc-v2 issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions