yanhan-chan commented on issue #5958:
URL: https://github.com/apache/seatunnel/issues/5958#issuecomment-1891240032

   @Carl-Zhou-CN Hi, I am trying to read data from my local mysql database 
using the jdbc connector. Here is the .conf file:
   <img width="365" alt="image" 
src="https://github.com/apache/seatunnel/assets/112475120/f695c166-1692-46e7-8f3f-d1a1a311c910";>
   
   Then i got this error:
   2024-01-15 11:10:46,070 INFO  
org.apache.seatunnel.core.starter.utils.ConfigBuilder - Loading config file 
from path: 
/home/yanhan/SeaTunnel-Dev/seatunnel-dev/seatunnel-examples/seatunnel-flink-connector-v2-example/target/classes/examples/mysql_to_local.conf
   2024-01-15 11:10:46,128 INFO  
org.apache.seatunnel.core.starter.utils.ConfigShadeUtils - Load config shade 
spi: [base64]
   2024-01-15 11:10:46,251 INFO  
org.apache.seatunnel.core.starter.utils.ConfigBuilder - Parsed config file: 
   {
       "env" : {
           "execution.parallelism" : 1,
           "job.mode" : "BATCH",
           "checkpoint.interval" : 10000
       },
       "source" : [
           {
               "password" : "yanhan123#",
               "driver" : "com.mysql.cj.jdbc.Driver",
               "query" : "select * from test_seatunnel",
               "connection_check_timeout_sec" : 100,
               "plugin_name" : "jdbc",
               "user" : "root",
               "url" : "jdbc:mysql://localhost:3306/?user=root"
           }
       ],
       "sink" : [
           {
               "plugin_name" : "Console"
           }
       ]
   }
   
   2024-01-15 11:10:46,281 INFO  
org.apache.seatunnel.plugin.discovery.AbstractPluginDiscovery - Load 
SeaTunnelSource Plugin from 
/home/yanhan/SeaTunnel-Dev/seatunnel-dev/seatunnel-common/connectors
   2024-01-15 11:10:46,282 INFO  
org.apache.seatunnel.plugin.discovery.AbstractPluginDiscovery - Load Factory 
Plugin from /home/yanhan/SeaTunnel-Dev/seatunnel-dev/seatunnel-common/connectors
   2024-01-15 11:10:46,309 INFO  
org.apache.seatunnel.plugin.discovery.AbstractPluginDiscovery - Load plugin: 
PluginIdentifier{engineType='seatunnel', pluginType='source', 
pluginName='jdbc'} from classpath
   2024-01-15 11:10:46,360 INFO  
org.apache.seatunnel.connectors.seatunnel.jdbc.utils.JdbcCatalogUtils - Loading 
catalog tables for catalog : class 
org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.mysql.MySqlCatalog
   2024-01-15 11:10:46,366 INFO  
org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.AbstractJdbcCatalog - 
Catalog MySQL closing
   2024-01-15 11:10:46,367 ERROR org.apache.seatunnel.core.starter.SeaTunnel - 
   
   
===============================================================================
   
   
   2024-01-15 11:10:46,368 ERROR org.apache.seatunnel.core.starter.SeaTunnel - 
Fatal Error, 
   
   2024-01-15 11:10:46,368 ERROR org.apache.seatunnel.core.starter.SeaTunnel - 
Please submit bug report in https://github.com/apache/seatunnel/issues
   
   2024-01-15 11:10:46,368 ERROR org.apache.seatunnel.core.starter.SeaTunnel - 
Reason:ErrorCode:[API-03], ErrorDescription:[Catalog initialize failed] - 
Failed connecting to jdbc:mysql://localhost:3306/?user=root via JDBC. 
   
   2024-01-15 11:10:46,370 ERROR org.apache.seatunnel.core.starter.SeaTunnel - 
Exception 
StackTrace:org.apache.seatunnel.api.table.catalog.exception.CatalogException: 
ErrorCode:[API-03], ErrorDescription:[Catalog initialize failed] - Failed 
connecting to jdbc:mysql://localhost:3306/?user=root via JDBC.
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.AbstractJdbcCatalog.getConnection(AbstractJdbcCatalog.java:121)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.AbstractJdbcCatalog.open(AbstractJdbcCatalog.java:127)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.utils.JdbcCatalogUtils.getTables(JdbcCatalogUtils.java:78)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.source.JdbcSource.<init>(JdbcSource.java:57)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.source.JdbcSourceFactory.lambda$createSource$0(JdbcSourceFactory.java:78)
        at 
org.apache.seatunnel.core.starter.execution.PluginUtil.createSource(PluginUtil.java:85)
        at 
org.apache.seatunnel.core.starter.flink.execution.SourceExecuteProcessor.initializePlugins(SourceExecuteProcessor.java:118)
        at 
org.apache.seatunnel.core.starter.flink.execution.FlinkAbstractPluginExecuteProcessor.<init>(FlinkAbstractPluginExecuteProcessor.java:76)
        at 
org.apache.seatunnel.core.starter.flink.execution.SourceExecuteProcessor.<init>(SourceExecuteProcessor.java:61)
        at 
org.apache.seatunnel.core.starter.flink.execution.FlinkExecution.<init>(FlinkExecution.java:91)
        at 
org.apache.seatunnel.core.starter.flink.command.FlinkTaskExecuteCommand.execute(FlinkTaskExecuteCommand.java:59)
        at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
        at 
org.apache.seatunnel.example.flink.v2.SeaTunnelApiExample.main(SeaTunnelApiExample.java:39)
   Caused by: java.sql.SQLException: No suitable driver found for 
jdbc:mysql://localhost:3306/?user=root
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:708)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:230)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.AbstractJdbcCatalog.getConnection(AbstractJdbcCatalog.java:117)
        ... 12 more
    
   2024-01-15 11:10:46,370 ERROR org.apache.seatunnel.core.starter.SeaTunnel - 
   
===============================================================================
   
   
   
   Exception in thread "main" 
org.apache.seatunnel.api.table.catalog.exception.CatalogException: 
ErrorCode:[API-03], ErrorDescription:[Catalog initialize failed] - Failed 
connecting to jdbc:mysql://localhost:3306/?user=root via JDBC.
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.AbstractJdbcCatalog.getConnection(AbstractJdbcCatalog.java:121)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.AbstractJdbcCatalog.open(AbstractJdbcCatalog.java:127)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.utils.JdbcCatalogUtils.getTables(JdbcCatalogUtils.java:78)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.source.JdbcSource.<init>(JdbcSource.java:57)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.source.JdbcSourceFactory.lambda$createSource$0(JdbcSourceFactory.java:78)
        at 
org.apache.seatunnel.core.starter.execution.PluginUtil.createSource(PluginUtil.java:85)
        at 
org.apache.seatunnel.core.starter.flink.execution.SourceExecuteProcessor.initializePlugins(SourceExecuteProcessor.java:118)
        at 
org.apache.seatunnel.core.starter.flink.execution.FlinkAbstractPluginExecuteProcessor.<init>(FlinkAbstractPluginExecuteProcessor.java:76)
        at 
org.apache.seatunnel.core.starter.flink.execution.SourceExecuteProcessor.<init>(SourceExecuteProcessor.java:61)
        at 
org.apache.seatunnel.core.starter.flink.execution.FlinkExecution.<init>(FlinkExecution.java:91)
        at 
org.apache.seatunnel.core.starter.flink.command.FlinkTaskExecuteCommand.execute(FlinkTaskExecuteCommand.java:59)
        at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
        at 
org.apache.seatunnel.example.flink.v2.SeaTunnelApiExample.main(SeaTunnelApiExample.java:39)
   Caused by: java.sql.SQLException: No suitable driver found for 
jdbc:mysql://localhost:3306/?user=root
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:708)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:230)
        at 
org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.AbstractJdbcCatalog.getConnection(AbstractJdbcCatalog.java:117)
        ... 12 more
   
   
   I went to this link: 
https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.27 and 
downloaded the respective jar file, and place it into this directory: 
   <img width="354" alt="image" 
src="https://github.com/apache/seatunnel/assets/112475120/4a30bb79-6203-4483-8e6f-badf1cd0c286";>
   
   Then I have also added the dependency in the pom.xml this way: 
   <img width="732" alt="image" 
src="https://github.com/apache/seatunnel/assets/112475120/450035d2-1dad-49a8-80b7-db689779c321";>
   
   I am not sure if i am doing all of this right or not. Can you provide some 
help? Thank you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to