提交 cce6dc73 编写于 作者: B BoDing

docs: java connect example free resource

上级 755af48f
......@@ -10,12 +10,12 @@ import java.sql.Statement;
public class ConnectCloudExample {
public static void main(String[] args) throws SQLException {
String jdbcUrl = System.getenv("TDENGINE_JDBC_URL");
Connection conn = DriverManager.getConnection(jdbcUrl);
Statement stmt = conn.createStatement();
// test the connection by firing a query
stmt.executeQuery("select server_version()");
stmt.close();
conn.close();
try(Connection conn = DriverManager.getConnection(jdbcUrl)) {
try(Statement stmt = conn.createStatement()) {
// test the connection by firing a query
stmt.executeQuery("select server_version()");
}
}
}
}
// ANCHOR_END: connect
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册