云服务器内容精选

  • 删除Doris表 以Java JDBC方式执行SQl语句删除集群中的dbName.tableName表。 String dropSql = "drop table " + dbName + "." + tableName; public static void execDDL(Connection connection, String sql) throws Exception { try (PreparedStatement statement = connection.prepareStatement(sql)) { statement.execute(); } catch (Exception e) { logger.error("Execute sql {} failed.", sql, e); throw new Exception(e); } } 父主题: Doris JDBC接口调用样例程序
  • 创建Doris表 以Java JDBC方式执行SQL语句在集群中dbName变量对应的数据库下创建tableName对应的表。 String createTableSql = "create table if not exists " + dbName + "." + tableName + " (\n" + "c1 int not null,\n" + "c2 int not null,\n" + "c3 string not null\n" + ") engine=olap\n" + "unique key(c1, c2)\n" + "distributed by hash(c1) buckets 1"; public static void execDDL(Connection connection, String sql) throws Exception { try (PreparedStatement statement = connection.prepareStatement(sql)) { statement.execute(); } catch (Exception e) { logger.error("Execute sql {} failed.", sql, e); throw new Exception(e); } } 父主题: Doris JDBC接口调用样例程序
  • 创建Doris数据库 以Java JDBC方式执行SQL语句在集群中创建dbName变量对应的数据库。 String createDatabaseSql = "create database if not exists " + dbName; public static void execDDL(Connection connection, String sql) throws Exception { try (PreparedStatement statement = connection.prepareStatement(sql)) { statement.execute(); } catch (Exception e) { logger.error("Execute sql {} failed.", sql, e); throw new Exception(e); } } 父主题: Doris JDBC接口调用样例程序
  • 删除Doris表 以Java JDBC方式执行SQl语句删除集群中的dbName.tableName表。 String dropSql = "drop table " + dbName + "." + tableName; public static void execDDL(Connection connection, String sql) throws Exception { try (PreparedStatement statement = connection.prepareStatement(sql)) { statement.execute(); } catch (Exception e) { logger.error("Execute sql {} failed.", sql, e); throw new Exception(e); } } 父主题: Doris JDBC接口调用样例程序