更新时间:2025-09-22 GMT+08:00
删除Doris表
本章节介绍删除Doris表样例代码。
以下代码片段在“JDBCExample”类中。
以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接口调用样例程序