Hi,

I happened to be playing with the this. Sharing some information I have so
far.

For the architecture view of the avatica server implementation, found this
diagram
=>
https://raw.githubusercontent.com/julianhyde/share/master/slides/avatica-architecture.png

1) The JSON is how the remote communicate talk to server. The
implementation is in org.apache.calcite.avatica.remote.RemoteService.java.

2) I haven't try with this url jdbc:avatica:remote:factory=...

3) The ConnectionFactory is where the jdbc connection is being created on
the server side.

On not able to access CalciteConnectionImpl,
you can resolve that by having your implementation of ConnectionFactory in
org.apache.calcite.jdbc package.

Below are my working project in scala based on csv example

A) CsvConnectionFactory.scala
---------------------------------------------------------------------------------------------
package org.apache.calcite.jdbc
import org.apache.calcite.avatica.Meta.Factory
import java.sql.DriverManager
class CsvConnectionFactory extends Factory {
  def create(x$1: java.util.List[String]): org.apache.calcite.avatica.Meta
= {
     val connection = DriverManager.getConnection(
"jdbc:calcite:model=/model.json",
"admin", "admin");
      return new
CalciteMetaImpl(connection.asInstanceOf[CalciteConnectionImpl])
  }
}
---------------------------------------------------------------------------------------------

B) To start csv example as Server
run org.apache.calcite.avatica.server.Main with argument
"org.apache.calcite.jdbc.CsvConnectionFactory"



C) JDBC Client Code for connecting
---------------------------------------------------------------------------------------------
package org.apache.calcite.jdbc

import java.sql.Connection
import java.sql.DriverManager

object HelloWorld {
  def main(args: Array[String]) {
    val port = 8765
    val connection: Connection  =
DriverManager.getConnection("jdbc:avatica:remote:url=http://localhost:"; +
port)
    val rs = connection.createStatement().executeQuery("select * from
EMPS")
    while (rs.next){
      println(rs.getString("NAME"))
    }
  }
}
---------------------------------------------------------------------------------------------

Hope this help.

Rgds,
jay


On Tue, Jan 20, 2015 at 5:34 AM, Hartman, Trevor <[email protected]> wrote:

> Running on latest sources now. My questions still remain. Also, I tried
> implementing a Meta.Factory based on CalciteRemoteDriverTest.Factory, but
> org.apache.calcite.jdbc.CalciteConnectionImpl is not accessible. How do I
> provide an instance of Meta?
>
> Thanks,
> Trevor
>

Reply via email to