[ 
https://issues.apache.org/jira/browse/PHOENIX-3359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15563255#comment-15563255
 ] 

Eric Lomore commented on PHOENIX-3359:
--------------------------------------

Upon further examination, the issue is actually in unwrapping the statement, 
not the connection.

// PhoenixConnection pc = conn.unwrap(PhoenixConnection.class); executes fine
// PhoenixStatement stmt = 
conn.createStatement().unwrap(PhoenixStatement.class); throws an error.

Unless we want to move things around, this seems as simple as:

{code}
Connection conn = DriverManager.getConnection(getUrl());
PhoenixConnection pc = conn.unwrap(PhoenixConnection.class);
PhoenixStatement stmt = (PhoenixStatement) pc.createStatement();{code}

Of course, we could also move this into an unwrap function in 
PhoenixCalciteConnection but a utility casting AvaticaStatement <---> 
PhoenixStatement requires 2 object creations.

That said, should I simply use the above fix and replace the old code in test 
cases?

> Update JDBC urls to match connection type
> -----------------------------------------
>
>                 Key: PHOENIX-3359
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3359
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Eric Lomore
>            Assignee: Eric Lomore
>
> Connection's that are intended to be unwrapped into PhoenixConnection's need 
> to be created using the old JDBC url, 
> {{DriverManager.getConnection(getOldUrl())}}
> {{PhoenixConnection pc = conn.unwrap(PhoenixConnection.class);}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to