[ https://issues.apache.org/jira/browse/FLINK-19435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17245898#comment-17245898 ]
Kezhu Wang commented on FLINK-19435: ------------------------------------ [~lzljs3620320] From capability side, it is nice to have driver class customization. But current implementation has margin to support this: 1. {{driverName}} is not used to filter {{Driver}} now. 2. {{PostgresCatalog}} and {{JdbcCatalog}} does not take {{driverName}} into account. 3. {{PostgresDialect.getRowConverter}} is tied to {{org.postgresql:postgresql}}. 4. Which driver should be default for jdbc dialect/connection if no {{driverName}} specified ? I prefer to driver selected by {{DriverManager.getConnection}}, it make {{JdbcDialect}} a step to driver-agnostic and free clients from caring about concrete driver class. But we may meet api compatibility issue as {{JdbcConnectionOptions}} has its own exposing path besides sql. [~lzljs3620320] [~jark] I think we may need steps to solve all discussions in this jira: 1. Fix deadlock issue by ensuring {{DriverManager}} is loaded before {{Class.forName(driverName)}}. We need touch {{JdbcInputFormat}}, {{JdbcLookupFunction}}, {{JdbcRowDataLookupFunction}} and {{SimpleJdbcConnectionProvider}}. 2. Migrate {{JdbcInputFormat}}, {{JdbcLookupFunction}}, {{JdbcRowDataLookupFunction}} to {{SimpleJdbcConnectionProvider}}. 3. Support driver class filter in {{SimpleJdbcConnectionProvider}}. We could assert this support in test with fake driver classes. 4. Solve rest concerns, such as: should {{JdbcConnectionOptions.driverName}} be optional from {{JdbcSink}} and sql ? What do you think ? > jdbc JDBCOutputFormat open function invoke Class.forName(drivername) > -------------------------------------------------------------------- > > Key: FLINK-19435 > URL: https://issues.apache.org/jira/browse/FLINK-19435 > Project: Flink > Issue Type: Improvement > Components: Connectors / JDBC > Affects Versions: 1.10.2 > Reporter: xiaodao > Priority: Major > Fix For: 1.13.0, 1.12.1 > > Attachments: image-2020-10-09-20-48-48-261.png, > image-2020-10-09-20-49-23-644.png > > > when we sink data to multi jdbc outputformat , > {code} > protected void establishConnection() throws SQLException, > ClassNotFoundException { > Class.forName(drivername); > if (username == null) { > connection = DriverManager.getConnection(dbURL); > } else { > connection = DriverManager.getConnection(dbURL, username, password); > } > } > {code} > may cause jdbc driver deadlock. it need to change to synchronized function. -- This message was sent by Atlassian Jira (v8.3.4#803005)