Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows restful driver 插入时间数据与查询不一致. timezone与代码tz不符 #29145

Open
pope12389 opened this issue Dec 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pope12389
Copy link

使用官方示例
create database demo;
use demo;
CREATE TABLE t (ts TIMESTAMP, speed INT);

使用restful连接,windows 下使用官方代码:
String jdbcUrl = "jdbc:TAOS-RS://10.10.10.6:6041?user=root&password=taosdata";
try (Connection conn = DriverManager.getConnection(jdbcUrl)) {
System.out.println("Connected to " + jdbcUrl + " successfully.");
conn.createStatement().execute("INSERT INTO demo.t VALUES('2019-09-20 03:22:10', 121);");
RestfulResultSet execute = (RestfulResultSet)conn.createStatement().executeQuery("select * from demo.t");

        // you can use the connection for execute SQL here

    } catch (Exception ex) {
        // please refer to the JDBC specifications for detailed exceptions info
        System.out.printf("Failed to connect to %s, %sErrMessage: %s%n",
                jdbcUrl,
                ex instanceof SQLException ? "ErrCode: " + ((SQLException) ex).getErrorCode() + ", " : "",
                ex.getMessage());
        // Print stack trace for context in examples. Use logging in production.
        ex.printStackTrace();
        throw ex;
    }

driver 版本: 3.3.2
执行成功:查询数据结果
2019-09-20 11:22:10.000 121

从结果上看是时区有问题。 源代码中 解析的是tz参数,文档给的是timezone。
无论如何调整tz参数,插入数据不变。

@pope12389 pope12389 added the bug Something isn't working label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant