You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jark Wu (Jira)" <ji...@apache.org> on 2020/10/28 10:20:00 UTC

[jira] [Commented] (FLINK-19851) flink sql client connector type jdbc exception

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

Jark Wu commented on FLINK-19851:
---------------------------------

Hi [~hulingchan], the exception tells that there is no JDBC factory found in the classpath. That means you may not put the {{flink-connector-jdbc}} jar under the Flink cluster classpath. Besides, registering tables in sql-client yaml is not suggested anymore, it is recommended to use DDL to register tables. See more details in the documentation: https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/connectors/jdbc.html

> flink sql client connector type jdbc exception
> ----------------------------------------------
>
>                 Key: FLINK-19851
>                 URL: https://issues.apache.org/jira/browse/FLINK-19851
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Client
>    Affects Versions: 1.11.1
>         Environment: hardware: Mac Pro
> software: MacOS
>  
>            Reporter: hulingchan
>            Priority: Major
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When I want to experience the SQL client using jdbc as the source, there is a problem.
> *run command*:
> ./sql-client.sh embedded -e ../conf/sql-client-demo.yaml
> *sql-client-demo.yaml conttent*:
> {code:java}
> tables:
>   - name: mysql_test
>     type: source-table
>     connector:
>         type: jdbc
>         property-version: 1
>         url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8&autoReconnect=true&serverTimezone=Asia/Shanghai
>         table: book_info
>         driver: com.mysql.jdbc.Driver
>         username: lloo
>         password: dsfsdf
> {code}
> *log below*:
> {code:java}
> No default environment specified.
>  Searching for 'flink-1.11.1/conf/sql-client-defaults.yaml'...found.
>  Reading default environment from: file:flink-1.11.1/conf/sql-client-defaults.yaml
>  Reading session environment from: file:flink-1.11.1/bin/../conf/sql-client-demo.yaml
> Exception in thread "main" org.apache.flink.table.client.SqlClientException: Unexpected exception. This is a bug. Please consider filing an issue.
>  at org.apache.flink.table.client.SqlClient.main(SqlClient.java:213)
>  Caused by: org.apache.flink.table.client.gateway.SqlExecutionException: Could not create execution context.
>  at org.apache.flink.table.client.gateway.local.ExecutionContext$Builder.build(ExecutionContext.java:870)
>  at org.apache.flink.table.client.gateway.local.LocalExecutor.openSession(LocalExecutor.java:227)
>  at org.apache.flink.table.client.SqlClient.start(SqlClient.java:108)
>  at org.apache.flink.table.client.SqlClient.main(SqlClient.java:201)
>  Caused by: org.apache.flink.table.api.NoMatchingTableFactoryException: Could not find a suitable table factory for 'org.apache.flink.table.factories.TableSourceFactory' in
>  the classpath.
> Reason: Required context properties mismatch.
> The following properties are requested:
>  connector.driver=com.mysql.jdbc.Driver
>  connector.password=123456
>  connector.property-version=1
>  connector.table=durotar_wx_user_info
>  connector.type=jdbc
>  connector.url=jdbc:mysql://qa.vm.com:3306/zh_portal?useUnicode=true&characterEncoding=utf8&autoReconnect=true&serverTimezone=Asia/Shanghai
>  connector.username=root
> The following factories have been considered:
>  org.apache.flink.table.sources.CsvBatchTableSourceFactory
>  org.apache.flink.table.sources.CsvAppendTableSourceFactory
>  org.apache.flink.table.filesystem.FileSystemTableFactory
>  at org.apache.flink.table.factories.TableFactoryService.filterByContext(TableFactoryService.java:322)
>  at org.apache.flink.table.factories.TableFactoryService.filter(TableFactoryService.java:190)
>  at org.apache.flink.table.factories.TableFactoryService.findSingleInternal(TableFactoryService.java:143)
>  at org.apache.flink.table.factories.TableFactoryService.find(TableFactoryService.java:113)
>  at org.apache.flink.table.client.gateway.local.ExecutionContext.createTableSource(ExecutionContext.java:384)
>  at org.apache.flink.table.client.gateway.local.ExecutionContext.lambda$initializeCatalogs$7(ExecutionContext.java:638)
>  at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
>  at org.apache.flink.table.client.gateway.local.ExecutionContext.initializeCatalogs(ExecutionContext.java:636)
>  at org.apache.flink.table.client.gateway.local.ExecutionContext.initializeTableEnvironment(ExecutionContext.java:523)
>  at org.apache.flink.table.client.gateway.local.ExecutionContext.<init>(ExecutionContext.java:183)
>  at org.apache.flink.table.client.gateway.local.ExecutionContext.<init>(ExecutionContext.java:136)
>  at org.apache.flink.table.client.gateway.local.ExecutionContext$Builder.build(ExecutionContext.java:859)
>  ... 3 more
>   
> {code}



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