Skip to content

jdbc: DATE/TIME format roundtrip fails #44

Closed
@ztarvos

Description

@ztarvos

DATE, TIME types cannot be retrieved as java.sql.Data, java.sql.Time correspondingly when inserted into appropriate DATE and TIME columns as strings ‘yyyy-mm-dd’ and ‘HH:MM:SS’.

The response contains strings whereas driver expects longs.

CREATE TABLE testdt(id INT PRIMARY KEY, d DATE)
INSERT INTO testdt(id, d) VALUES (1, '1983-03-14')

Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT d FROM testdt");
rs.next();
rs.getDate(1) - fails

Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number at org.tarantool.jdbc.SQLResultSet.getNumber(SQLResultSet.java:106) at org.tarantool.jdbc.SQLResultSet.getLong(SQLResultSet.java:112) at org.tarantool.jdbc.SQLResultSet.getDate(SQLResultSet.java:138) at TestJdbcDateTime.main(TestJdbcDateTime.java:29)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjdbc

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions