文档

创建时空表

更新时间:
一键部署

 创建时空表,数据库账号使用普通账号即可。

注意: 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.XX.XX: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");
    }
}
  • 本页导读 (1)
文档反馈