Updated on 2026-06-29 GMT+08:00

Deleting a Doris table

This section describes the sample code for deleting a Doris table.

The following code snippet is in the JDBCExample class.

Run the SQL statement in Java JDBC mode to delete the dbName.tableName table from the cluster.

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);
   }
}