Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> Trouble with Boolean,integer and timestamp


Copy link to this message
-
Re: Trouble with Boolean,integer and timestamp
1. You're using hbql library to interact with hbase not the java
client. I don't know how up-to-date hbql is with hbase versions. From
their site it appears to be close to a year old
(http://hbql.com/download.html)

2. I'm not sure why you want to store a "number" and retrieve that as
a boolean.

If you are trying to explore hbase, I'd recommend that you use the
hbase java client rather than an additional intermediate layer like
hbql. Once you are comfortable with the java client, you can see if
you can make hbql work (and perhaps fix minor issues that may exist
with it to work with the version of hbase you are using).
See http://hbase.apache.org/book/config.files.html#client_dependencies
and checkout HTable or HTablePool to connect to the cluster.

Hope that helps.
--Suraj

On Wed, Dec 21, 2011 at 5:52 AM, neuron005 <[EMAIL PROTECTED]> wrote:
>
> Hiii there
> I am new to hbase and trying to explore it. I am trying to store some values
> to hbase using my java program. Though I can easily store string values and
> retrieve them but I am having trouble with Boolean int and timestamp.
> Boolean --- whatever number I save between 0 to 9 it results in true
>
> int -- does not let me store a number less than 3 digits and if i store a
> number of 4 or 5 digits it results in different value
>
> timestamp: How can I get timestamp from hbase for a particular column so
> that I can apply toString() method on it to get in format yyyy:mm:dd
> Here is my sample program of java with which I am trying
> --------------------------------Please add necessary jars to
> classpath(hbql,hadoop-core,hbase,commons,antlr,zookeeper,log4j)
> import java.sql.*;
> import java.util.Date;
> public class test
> {
> public static void main(String args[])
> {
> Connection con=null;
> Statement stmt = null;
>        try{
>                Class.forName("org.apache.hadoop.hbase.jdbc.Driver");
>                con = DriverManager.getConnection("jdbc:hbql");
>        stmt=con.createStatement();
>    stmt.execute("CREATE TABLE Activity (f1()) IF NOT
> tableexists('Activity')");
>
>    stmt.execute("CREATE TEMP MAPPING scho8 FOR TABLE Activity"
>                 + "("
>                 + "keyval key, "
>                 + "f1 ("
>                 + "User string alias User, "
>                 + " date DATE alias date, "
>                + " count INTEGER alias count, "
>                + " flag boolean alias flag "
>                 + ") "
>                 + ")");
>
>    ResultSet rs = stmt.executeQuery("select * from scho8");
>    System.out.println("hii there");
>    while (rs.next()) {
>        System.out.println("hii there you");
>        String user=rs.getString("User");
>        Date feedDate=rs.getDate("date");
>        Timestamp timestamp=rs.getTimestamp("date");
>        int comment = rs.getInt("count");
>
>        boolean flag=rs.getBoolean("flag");
>
>        System.out.println("user is : "+ user);
>
>        System.out.print("feed Date is :"+feedDate);
>        System.out.println("Timestamp received is"+timestamp);
>        System.out.println("Comment count is: " + comment);
>        System.out.println("Flag is: "+flag);
>        System.out.print("feed Date is :"+timestamp.toString());
>    }
>   rs.close();
>    stmt.close();
>    con.close();
>        }catch(Exception e)
>        {
>                e.printStackTrace();
>        }
> }
> }
>
>
>
> --
> View this message in context: http://old.nabble.com/Trouble-with-Boolean%2Cinteger-and-timestamp-tp33016853p33016853.html
> Sent from the HBase User mailing list archive at Nabble.com.
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB