Update a Hbase Table data using Java

Category : Hadoop | Sub Category : Apache HBase | By Runner Dev Last updated: 2020-10-17 21:08:49 Viewed : 161

Update a Hbase Table  data using Java

1.        Create a maven project

Dependency : add the below dependency in pom.xml


https://mvnrepository.com/artifact/org.apache.hbase/hbase-client -->







 2. Update a Hbase Table  

Table Name: HbaseUpdate.java


 package com.runnerdev;


import java.io.IOException;


import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.hbase.HBaseConfiguration;

import org.apache.hadoop.hbase.client.HTable;

import org.apache.hadoop.hbase.client.Put;

import org.apache.hadoop.hbase.util.Bytes;



 * Update data from Hbase in java




public class HbaseUpdate {


          static String hbase_host = "";

          static String hbase_Port = "2191";


          public static void main(String[] args) {

                    try {

                              Configuration conf = HBaseConfiguration.create();

                              conf.set("hbase.zookeeper.quorum", hbase_host);

                              conf.set("hbase.zookeeper.clientPort", hbase_Port);

                              System.out.println("Conf::" + conf);


                              HTable hTable = new HTable(conf, "Employee");// Instantiating HTable class

                              Put p = new Put(Bytes.toBytes("9"));

                              /** Updating a name value here **/

                              p.add(Bytes.toBytes("cf"), Bytes.toBytes("name"), Bytes.toBytes("Krishna"));


                              hTable.put(p);// updating the put Instance to the HTable.

                              System.out.println("Record updated successfully!!");


                              // closing HTable



                    } catch (IOException e) {









Run  above program as follows:

Related Articles

Leave a Comment: