apl 连接hbase数据库
public class Getconnection { public static void main(String[] args) { //创建连接配置对象 Configuration conf = new Configuration(); //添加配置参数 conf.set("hbase.zookeeper.quorum","hadoop102,hadoop103,hadoop104"); Connection connection = null; //创建连接 try { connection = ConnectionFactory.createConnection(conf); } catch (IOException e) { e.printStackTrace(); } //创建一步连接 CompletableFuture<AsyncConnection> asyncConnection = ConnectionFactory.createAsyncConnection(conf); //使用连接 System.out.println(connection); //关闭连接 try { connection.close(); } catch (IOException e) { e.printStackTrace(); } } }