phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Reid <gabriel.r...@gmail.com>
Subject Re: JDBC: Result set is null (Select)
Date Mon, 12 Jan 2015 13:44:49 GMT
Hi Marco,

Because the name of your 'e' column is not quoted in your DDL
statement, the column name 'e' internally gets upper-cased to 'E'. If
you store values under column-family 'events' and column qualifier
'E', they will show up in Phoenix queries.

Alternatively, you can change your DDL statement to 'create table
\"truck_events\"  ( pk varchar primary key, \"events\"."e" VARCHAR)'
and then the data as you posted it should show up in you query
results.

- Gabriel


On Mon, Jan 12, 2015 at 10:58 AM, Marco <marco.frg@gmail.com> wrote:
> I have a table 'truck_events' in Hbase, which I've created via Phoenix :
>
> stmt.executeUpdate("create table \"truck_events\"  ( pk varchar
> primary key, \"events\".e VARCHAR)");
>
> Now, I fill with a java application data into this table. This works
> well. The rows in Hbase Shell
> looks like:
>
> ROW                   COLUMN+CELL
>  11|1|922337061612340 column=events:d, timestamp=1421050588783, value=11
>  8527
>  11|1|922337061612340 column=events:e, timestamp=1421050588783, value=Normal
>  8527
>  11|1|922337061612340 column=events:la, timestamp=1421050588783, value=42.143401
>  8527                 00000004
>  11|1|922337061612340 column=events:lo, timestamp=1421050588783, value=-79.67304
>  8527                 1999999896
>  11|1|922337061612340 column=events:t, timestamp=1421050588783, value=1
>  8527
>  11|1|922337061612340 column=events:tim, timestamp=1421050588783, value=\x00\x00
>  8527                 \x01J\xCA0?p
>  11|1|922337061612341 column=events:d, timestamp=1421050588770, value=11
>  2542
>
>
> Now I want to select the data via Apache Phoenix via JDBC:
>
> PreparedStatement statement = con.prepareStatement("select * from
> \"truck_events\"");
> rset = statement.executeQuery();
>
> ResultSetMetaData rsmd = rset.getMetaData();
> System.out.println("No. of columns : " + rsmd.getColumnCount());
>
> while (rset.next()) {
>     System.out.println(rset.getString(2));
> }
>
> The select statement works, but the result set (rset.getString())
> returns for each row 'null'. Also if I provide the column name. What
> do I do wrong here?
>
> I've tried it with a simple other table and there all works fine.
>
> Thanks,
> Marco

Mime
View raw message