Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase, mail # user - Cannot connect to local hbase database


+
Paul van Hoven 2013-02-12, 10:50
Copy link to this message
-
Re: Cannot connect to local hbase database
Samir Ahmic 2013-02-12, 11:13
Hi, Paul

Look like to me that you did not point your java program to correct
HBase configuration. Look at HTablePool constructor at:
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html#HTablePool()

Maybe you should try it like this:

Configuration conf = HBaseConfiguration.create();
HTablePool pool = new HTablePool(conf, 10);

Cheers
On Tue, Feb 12, 2013 at 11:50 AM, Paul van Hoven
<[EMAIL PROTECTED]> wrote:
> I'm trying to connect to my hbase database via java program but I
> cannot access my database because I get an error message. I checked
> that the database is actually running correctly.
>
> Java program:
> public class HBaseDemo {
>
>         public static void main(String[] args )
>         {
>                 try {
>
>                         HTablePool pool = new HTablePool();
>                         HTableInterface userTable = pool.getTable("users");
>
>                         Put p = new Put(Bytes.toBytes("CaptainPicard"));
>                         p.add( Bytes.toBytes("info"), Bytes.toBytes("name"),
> Bytes.toBytes("Jean Luc Picard") );
>                         p.add( Bytes.toBytes("info"), Bytes.toBytes("email"),
> Bytes.toBytes("[EMAIL PROTECTED]") );
>                         p.add( Bytes.toBytes("info"), Bytes.toBytes("password"),
> Bytes.toBytes("ncc1701d") );
>                         userTable.put( p );
>
>                         Get g = new Get(Bytes.toBytes("CaptainPicard"));
>                         g.addFamily(Bytes.toBytes("info"));
>
>                         Result r = userTable.get(g);
>                         String email    = Bytes.toString( r.getValue(
> Bytes.toBytes("info"), Bytes.toBytes("email")) );
>                         String name     = Bytes.toString( r.getValue(
> Bytes.toBytes("info"), Bytes.toBytes("name")) );
>                         String password = Bytes.toString( r.getValue(
> Bytes.toBytes("info"), Bytes.toBytes("password")) );
>                         System.out.println( "name = " + name + "\npassword = " + password +
> "\nemail = " + email );
>                         userTable.close();
>
>                 } catch ( Exception e ) {
>                         e.printStackTrace();
>                 }
>         }
> }
>
>
> This is the output of my program:
> 2013-02-12 11:33:03.338 java[33339:1703] Unable to load realm info
> from SCDynamicStore
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:zookeeper.version=3.4.5-1392090, built on 09/30/2012 17:52
> GMT
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:host.name=172.16.100.71
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:java.version=1.7.0_09
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:java.vendor=Oracle Corporation
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:java.class.path=/diverse/paths/omitted
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:java.library.path=/Users/Tom/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:java.io.tmpdir=/var/folders/0s/j6874rlj63qccjx38ltmwy880000gn/T/
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:java.compiler=<NA>
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client environment:os.name=Mac OS X
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client environment:os.arch=x86_64
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client environment:os.version=10.8.2
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client environment:user.name=Tom
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:user.home=/Users/Tom
> 13/02/12 11:33:03 INFO zookeeper.ZooKeeper: Client
> environment:user.dir=/Users/Tom/Freelancing/HitFox/hbase/HBaseDemo
+
Paul van Hoven 2013-02-12, 11:25