Skip to content

Instantly share code, notes, and snippets.

@AhianZhang
Created June 4, 2018 14:13
Show Gist options
  • Save AhianZhang/c9dd258293eece7fa033fdc478e67208 to your computer and use it in GitHub Desktop.
Save AhianZhang/c9dd258293eece7fa033fdc478e67208 to your computer and use it in GitHub Desktop.
HbaseTest
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.Table;
import org.junit.Test;
import java.io.IOException;
/**
* Created by AhianZhang on 2018/5/29.
*/
public class HBaseTest
{
@Test
public void getConnTest() throws IOException
{
Connection conn = HbaseConn.getHBaseConn();
System.out.println(conn.isClosed());
HbaseConn.closeConn();
System.out.println(conn.isClosed());
}
@Test
public void getTableTest() throws IOException
{
Table table = HbaseConn.getTable("US_POPULATION");
System.out.println(table.getName().getNameAsString());
table.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment