Help Center/ CloudTable Service/ Developer Guide/ HBase Application Development Guide/ Developing HBase Applications/ HBase Data Read/Write Sample Project/ Deleting HBase Data
Updated on 2026-01-04 GMT+08:00
Deleting HBase Data
Function Description
In HBase, data (a row of data or data sets) is deleted using the delete method of a Table instance.
The specified deletion method is based on the scenario.
Sample Code
public void testDelete() {
LOG.info("Entering testDelete.");
byte[] rowKey = Bytes.toBytes("012005000201");
Table table = null;
try {
// Instantiate an HTable object.
table = conn.getTable(tableName);
// Instantiate a Delete object.
Delete delete = new Delete(rowKey);
// Submit a delete request.
table.delete(delete);
LOG.info("Delete table successfully.");
} catch (IOException e) {
LOG.error("Delete table failed " ,e);
} finally {
if (table != null) {
try {
// Close the HTable object.
table.close();
} catch (IOException e) {
LOG.error("Close table failed " ,e);
}
}
}
LOG.info("Exiting testDelete.");
} Parent topic: HBase Data Read/Write Sample Project
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.