You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Yiannis Gkoufas <jo...@gmail.com> on 2016/02/29 15:16:10 UTC

Minimal Example of Avatica Server

Hi guys,

first of all, congratulations for this lovely project!
I was trying to understand how to develop a minimal JDBC server using
Avatica and it wasn't very clear to me from the tests.
I didn't want to use HSQLDB Factory as the example provided on the tests.
I would really appreciate any pointers.

Thanks!

Re: Minimal Example of Avatica Server

Posted by Yiannis Gkoufas <jo...@gmail.com>.
Thanks a lot Josh!
Will have a look at the examples and let you know if I face any problems!

Best Regards

On 29 February 2016 at 15:05, Josh Elser <jo...@gmail.com> wrote:

> Hi Yiannis,
>
> Thanks for the kind words, and happy to see you here.
>
> In general, you can construct your own server by doing the following:
>
> ```
> JdbcMeta meta = new JdbcMeta(...); // Provide the correct JDBC url here
> LocalService service = new LocalService(meta, ...); // Construct the
> service around JdbcMeta
>
> // Construct a Jetty Handler for the HTTP Server
> HandlerFactory factory = new HandlerFactory();
> Handler handler = factory.getHandler(service,
> Driver.Serialization.PROTOBUF);
>
> // Start the HTTP server with the provided service and handler
> HttpServer server = new HttpServer(service, handler);
>
> // Start the server
> server.start();
> ```
>
> We could probably stand for more documentation here (and a clearer API
> statement). Would love to hear back how it works out for you. You could
> also take a look at the server in use by Phoenix[1].
>
> - Josh
>
> [1]
> https://github.com/apache/phoenix/blob/master/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
>
>
> Yiannis Gkoufas wrote:
>
>> Hi guys,
>>
>> first of all, congratulations for this lovely project!
>> I was trying to understand how to develop a minimal JDBC server using
>> Avatica and it wasn't very clear to me from the tests.
>> I didn't want to use HSQLDB Factory as the example provided on the tests.
>> I would really appreciate any pointers.
>>
>> Thanks!
>>
>>

Re: Minimal Example of Avatica Server

Posted by Josh Elser <jo...@gmail.com>.
Hi Yiannis,

Thanks for the kind words, and happy to see you here.

In general, you can construct your own server by doing the following:

```
JdbcMeta meta = new JdbcMeta(...); // Provide the correct JDBC url here
LocalService service = new LocalService(meta, ...); // Construct the 
service around JdbcMeta

// Construct a Jetty Handler for the HTTP Server
HandlerFactory factory = new HandlerFactory();
Handler handler = factory.getHandler(service, 
Driver.Serialization.PROTOBUF);

// Start the HTTP server with the provided service and handler
HttpServer server = new HttpServer(service, handler);

// Start the server
server.start();
```

We could probably stand for more documentation here (and a clearer API 
statement). Would love to hear back how it works out for you. You could 
also take a look at the server in use by Phoenix[1].

- Josh

[1] 
https://github.com/apache/phoenix/blob/master/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java

Yiannis Gkoufas wrote:
> Hi guys,
>
> first of all, congratulations for this lovely project!
> I was trying to understand how to develop a minimal JDBC server using
> Avatica and it wasn't very clear to me from the tests.
> I didn't want to use HSQLDB Factory as the example provided on the tests.
> I would really appreciate any pointers.
>
> Thanks!
>