You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 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;
}
使用官方示例
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");
driver 版本: 3.3.2
执行成功:查询数据结果
2019-09-20 11:22:10.000 121
从结果上看是时区有问题。 源代码中 解析的是tz参数,文档给的是timezone。
无论如何调整tz参数,插入数据不变。
The text was updated successfully, but these errors were encountered: