You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2021/09/02 19:30:00 UTC

[jira] [Comment Edited] (CALCITE-4760) RelBuilder creation fails with error 'No suitable driver found for jdbc:calcite:' in shaded Calcite

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

Julian Hyde edited comment on CALCITE-4760 at 9/2/21, 7:29 PM:
---------------------------------------------------------------

The error is thrown when the {{Frameworks.prepare}} method creates a connection (for internal use) using the JDBC driver manager. I propose to fix this by creating a connection directly, not via the driver manager.

The cause seems to be shading. Usually the driver is automatically recognized when the jar is loaded. But after shading, the {{META-INF/services/java.sql.Driver}} file still exists and still contains the line {{org.apache.calcite.jdbc.Driver}} but that class has been renamed during the shading process.

This problem could also be caused by re-packaging jars. If you leave out the {{META-INF/services/java.sql.Driver}} file the driver won't get loaded by the driver manager.

FLINK-4581 is an issue that has similar symptoms. It's not clear whether shading is the cause.

It's a bit strange that Calcite is creating JDBC connections for internal purposes. In principle we could make something more minimal than a JDBC connection.


was (Author: julianhyde):
The cause seems to be shading. The {{META-INF/services/java.sql.Driver}} file still exists and still contains the line {{org.apache.calcite.jdbc.Driver}} but that class has been renamed during the shading process.

FLINK-4581 is an issue that has similar symptoms. It's not clear whether shading is the cause.

This problem could also be caused by re-packaging jars. If you leave out the {{META-INF/services/java.sql.Driver}} file the driver won't get loaded by the driver manager.

I propose to fix this by creating a connection directly, not via the driver manager.

It's a bit strange that Calcite is creating JDBC connections for internal purposes. In principle we could make something more minimal than a JDBC connection.

> RelBuilder creation fails with  error 'No suitable driver found for jdbc:calcite:' in shaded Calcite
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4760
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4760
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Steven Talbot
>            Assignee: Julian Hyde
>            Priority: Major
>
> {{RelBuilder}} creation fails with error 'No suitable driver found for jdbc:calcite:'. We should not need to initialize a "jdbc:calcite" driver to make a {{RelBuilder}}.
> We just tracked down a nasty issue with Calcite being shaded as a dependency in our code that could cause a stack like
>  
> {noformat}
> No suitable driver found for jdbc:calcite: 
> org/apache/calcite/tools/Frameworks.java:184:in withPrepare 
> org/apache/calcite/tools/RelBuilder.java:225:in create
> {noformat}
> when calling {{RelBuilder.create}}.
> Our fault ultimately, but [~julianhyde] pointed out that Calcite really shouldn't be trying to make a JDBC connection here.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)