hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Silvia <silvia.gall...@gmail.com>
Subject Re: Hbase and Eclipse on ubuntu
Date Tue, 29 Nov 2011 13:36:45 GMT
Hi,
first of all i'm running Hbase and Ubuntu on the same machine. 
I have write this code. I took the helper classe from this 
https://github.com/larsgeorge/hbase-book/blob/master/ch03/src/main/java/util/HBaseHelper.java
link 

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;

public class PutExample {
	public static void main(String[] args) throws IOException {
		Configuration conf = HBaseConfiguration.create(); //Crea una
configurazione
		HBaseHelper helper = HBaseHelper.getHelper(conf);
		helper.dropTable("testtable");
		helper.createTable("testtable", "colfam1");
		HTable table = new HTable(conf, "testtable"); //tabelle testtable
		Put put = new Put(Bytes.toBytes("row1")); 
		put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"),
		Bytes.toBytes("val1"));
		put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual2"),
		Bytes.toBytes("val2"));
		table.put(put);
		}
	}


when i run this code the Eclipse's console give me the message "Usage:
MapFile inFile outFile" and the table "testtable" there isn't in hbase.

Thanks Silvia

--
View this message in context: http://apache-hbase.679495.n3.nabble.com/Hbase-and-Eclipse-on-ubuntu-tp3541797p3545191.html
Sent from the HBase - Developer mailing list archive at Nabble.com.

Mime
View raw message