Skip to content

JDBC ResultSet.getTime() returns null if time value has fractional seconds #10682

@lukaseder

Description

@lukaseder

What happens?

I cannot fetch ResultSet.getTime() from the JDBC driver.

To Reproduce

Try this Java code:

import org.duckdb.DuckDBConnection;
import java.sql.DriverManager;

DuckDBConnection connection = (DuckDBConnection) DriverManager.getConnection("jdbc:duckdb:");
try (
    Statement s = connection.createStatement();
    ResultSet rs = s.executeQuery("select current_time")
) {
    while (rs.next()) {
        System.out.println(rs.getTime(1));
        System.out.println(rs.getString(1));
    }
}

It prints something along the lines of:

null
09:32:52.936

The problem is that java.sql.Time.valueOf(String) doesn't accept fractional seconds. After the exception is thrown by JDBC, null is simply returned:

OS:

Microsoft Windows [Version 10.0.22631.3007]

DuckDB Version:

0.10.0

DuckDB Client:

JDBC

Full Name:

Lukas Eder

Affiliation:

Data Geekery

Have you tried this on the latest nightly build?

I have tested with a nightly build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions