phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From F21 <f21.gro...@gmail.com>
Subject Re: apache phoenix json api
Date Wed, 13 Apr 2016 10:29:44 GMT
Your PrepareAndExecute request is missing a statementId: 
https://calcite.apache.org/docs/avatica_json_reference.html#prepareandexecuterequest

Before calling PrepareAndExecute, you need to send a CreateStatement 
request to the server so that it can give you a statementId. Then, use 
that statementId in your PrepareAndExecute request and all should be fine :)


On 13/04/2016 8:24 PM, Plamen Paskov wrote:
> Hi guys,
> I just setup apache phoenix 4.7 and set the serialization to JSON. Now 
> i'm trying to run a select statement but what i receive is this:
>
> {
>   "response": "executeResults",
>   "missingStatement": true,
>   "rpcMetadata": {
>     "response": "rpcMetadata",
>     "serverAddress": "ip-172-31-27-198:8765"
>   },
>   "results": null
> }
>
> My request looks like this:
>
> curl -XPOST -H 'request: {"request":"prepareAndExecute", 
> "connectionId":"1", "sql":"select * from us_population", 
> "maxRowCount":-1}' http://52.31.63.96:8765/
>
> Running the select above from the command line is fine and it returns 
> 2 rows :
>
> sqlline version 1.1.8
> 0: jdbc:phoenix:localhost> select * from us_population;
> +-------+------------------------------------------+------------------------------------------+

>
> | STATE |                   CITY                   | 
> POPULATION                |
> +-------+------------------------------------------+------------------------------------------+

>
> | CA    | Los Angeles                              | 
> 3844829                                  |
> | NY    | New York                                 | 
> 8143197                                  |
> +-------+------------------------------------------+------------------------------------------+

>
> 2 rows selected (0.087 seconds)
>
> Can you give me some direction what i'm doing wrong as i'm not java 
> dev and it's not possible for me to read and understand the source code.
>
> Thanks in advance !


Mime
View raw message