Help Center/ MapReduce Service/ Developer Guide (Normal_3.x)/ HBase Development Guide (Normal Mode)/ Developing an Application/ Reading/Writing Data/ Writing Data to the PhoenixTable
Updated on 2025-10-23 GMT+08:00
Writing Data to the PhoenixTable
Function
The Phoenix table enables data writing in HBase.
Example Code
The following code snippet belongs to the testPutmethod in the PhoenixSample class of the com.huawei.bigdata.hbase.examplespackage.
/**
* Put data
*/
public void testPut() {
LOG.info("Entering testPut.");
String URL = "jdbc:phoenix:" + conf.get("hbase.zookeeper.quorum");
// Insert
String upsertSQL =
"UPSERT INTO TEST VALUES(1,'John','100000', TO_DATE('1980-01-01','yyyy-MM-dd'))";
try (Connection conn = DriverManager.getConnection(url, props);
Statement stat = conn.createStatement()){
// Execute Update SQL
stat.executeUpdate(upsertSQL);
conn.commit();
LOG.info("Put successfully.");
} catch (Exception e) {
LOG.error("Put failed.", e);
}
LOG.info("Exiting testPut.");
} Parent topic: Reading/Writing Data
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.