[ 
https://issues.apache.org/jira/browse/CALCITE-5719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Parag Jain updated CALCITE-5719:
--------------------------------
    Description: 
I have been using calcite-avatica-go driver to connect to Apache Druid and 
facing few issues -
 # In Go sql package when an idle connection is picked from the pool, 
*ResetSession* method is called on the connection. In the drivers 
implementation of this method 
[here|https://github.com/apache/calcite-avatica-go/blob/main/connection.go#L236],
 *registerConn* method is called which actually does an *OpenConnectionRequest* 
with the existing connectionId. On the Druid side it actually throws an 
exception 
[here|https://github.com/apache/druid/blob/master/sql/src/main/java/org/apache/druid/sql/avatica/DruidMeta.java#L823]
 saying the connection is already open. I checked other driver implementations 
like [postgres|https://github.com/jackc/pgx/blob/master/stdlib/sql.go#L307] and 
[mysql|https://github.com/go-sql-driver/mysql/blob/master/connection.go#L638] 
for ResetSession method and they actually don't open a new connection. So not 
sure about the reason for doing this here. Any thoughts on this ?
 # Username and pwd not being propagated in the JDBC context. Had to add the 
following code in the 
[Connect|https://github.com/apache/calcite-avatica-go/blob/main/driver.go#L64] 
method of driver.go to make it work

{code:java}
    if config.avaticaUser != "" {
        c.Info["user"] = config.avaticaUser
    }
    if config.avaticaPassword != "" {
        c.Info["password"] = config.avaticaPassword
    } {code}

  was:
I have been using calcite-avatica-go driver to connect to Apache Druid and 
facing few issues -
 # In Go sql package when an idle connection is picked from the pool, 
*ResetSession* method is called on the connection. In the drivers 
implementation of this method 
[here|https://github.com/apache/calcite-avatica-go/blob/main/connection.go#L236],
 *registerConn* method is called which actually does an *OpenConnectionRequest* 
with the existing connectionId. On the Druid side it actually throws an 
exception 
[here|https://github.com/apache/druid/blob/master/sql/src/main/java/org/apache/druid/sql/avatica/DruidMeta.java#L823]
 saying the connection is already open. I checked other driver implementations 
like [postgres|https://github.com/jackc/pgx/blob/master/stdlib/sql.go#L307] and 
[mysql|https://github.com/go-sql-driver/mysql/blob/master/connection.go#L638] 
for ResetSession method and they actually don't open a new connection. So not 
sure about the reason for doing this here. Any thoughts on this ?
 # Username and pwd not being propagated in the JDBC context. Had to add the 
following code in the [Connect| 
https://github.com/apache/calcite-avatica-go/blob/main/driver.go#L64] method of 
driver.go 

{code:java}
    if config.avaticaUser != "" {
        c.Info["user"] = config.avaticaUser
    }
    if config.avaticaPassword != "" {
        c.Info["password"] = config.avaticaPassword
    } {code}


> Issues with connection and authentication with Apache Druid
> -----------------------------------------------------------
>
>                 Key: CALCITE-5719
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5719
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica-go
>            Reporter: Parag Jain
>            Assignee: Francis Chuang
>            Priority: Major
>              Labels: avatica
>
> I have been using calcite-avatica-go driver to connect to Apache Druid and 
> facing few issues -
>  # In Go sql package when an idle connection is picked from the pool, 
> *ResetSession* method is called on the connection. In the drivers 
> implementation of this method 
> [here|https://github.com/apache/calcite-avatica-go/blob/main/connection.go#L236],
>  *registerConn* method is called which actually does an 
> *OpenConnectionRequest* with the existing connectionId. On the Druid side it 
> actually throws an exception 
> [here|https://github.com/apache/druid/blob/master/sql/src/main/java/org/apache/druid/sql/avatica/DruidMeta.java#L823]
>  saying the connection is already open. I checked other driver 
> implementations like 
> [postgres|https://github.com/jackc/pgx/blob/master/stdlib/sql.go#L307] and 
> [mysql|https://github.com/go-sql-driver/mysql/blob/master/connection.go#L638] 
> for ResetSession method and they actually don't open a new connection. So not 
> sure about the reason for doing this here. Any thoughts on this ?
>  # Username and pwd not being propagated in the JDBC context. Had to add the 
> following code in the 
> [Connect|https://github.com/apache/calcite-avatica-go/blob/main/driver.go#L64]
>  method of driver.go to make it work
> {code:java}
>     if config.avaticaUser != "" {
>         c.Info["user"] = config.avaticaUser
>     }
>     if config.avaticaPassword != "" {
>         c.Info["password"] = config.avaticaPassword
>     } {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to