创建时空表
创建时空表,数据库账号使用普通账号即可。
注意: getConnection中host地址,用户名/密码,根据自己实例情况填写。
public class CreateJDBC {
public static void main(String args[]) {
Connection conn = null;
Statement stmt = null;
try{
Class.forName("org.postgresql.Driver");
//用户请使用自己的账号和密码
conn = DriverManager.getConnection("jdbc:postgresql://139.224.168.86:5432/doc","citybrain", "Tsdb2gaia");
stmt = conn.createStatement();
String sql = "CREATE TABLE tsdb_test( uid bigint, time timestamp, speed float, position GEO_SHAPE) CLUSTERED INTO 20 SHARDS ;" ;
stmt.executeUpdate(sql);
stmt.close();
conn.close();
} catch (Exception e) {
System.err.println(e.getClass().getName() + " : " + e.getMessage());
System.exit(0);
}
System.out.println("Create table successfully");
}
}
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。
评论