hbase support

This commit is contained in:
温少
2012-05-18 22:52:20 +08:00
4 changed files with 14 additions and 4 deletions
@@ -15,7 +15,7 @@ public class HBaseDriver implements Driver {
return null;
}
String rest = url.substring(PREFIX.length() + 1);
String rest = url.substring(PREFIX.length());
info.put("hbase.zookeeper.quorum", rest);
@@ -7,6 +7,7 @@ import java.sql.Statement;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.util.Bytes;
import com.alibaba.druid.common.jdbc.ResultSetBase;
@@ -59,6 +60,14 @@ public class HBaseResultSet extends ResultSetBase {
public Object getObjectInternal(int columnIndex) {
return null;
}
@Override
public String getString(String columnName) throws SQLException {
byte[] qualifier = Bytes.toBytes(columnName);
byte[] family = Bytes.toBytes("d");
byte[] value = result.getValue(family, qualifier);
return Bytes.toString(value);
}
@Override
public void close() throws SQLException {