phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Lomore (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (PHOENIX-3359) Update JDBC urls to match connection type
Date Mon, 10 Oct 2016 19:41:20 GMT

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

Eric Lomore edited comment on PHOENIX-3359 at 10/10/16 7:41 PM:
----------------------------------------------------------------

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, [~maryannxue] should I simply use the above fix and replace the old code in test
cases?


was (Author: lomoree):
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)

Mime
View raw message