Flink JDBC executeBatch error, retry times = 0

2022-06-04 09:04:01,098 ERROR org.apache.flink.connector.jdbc.internal.JdbcBatchingOutputFormat [] - JDBC executeBatch error, retry times = 0
java.sql.SQLException: No operations allowed after statement closed.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965) ~[mysql-connector-java-5.1.49.jar:5.1.49]
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898) ~[mysql-connector-java-5.1.49.jar:5.1.49]
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887) ~[mysql-connector-java-5.1.49.jar:5.1.49]
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861) ~[mysql-connector-java-5.1.49.jar:5.1.49]
	at com.mysql.jdbc.StatementImpl.checkClosed(StatementImpl.java:426) ~[mysql-connector-java-5.1.49.jar:5.1.49]
	at com.mysql.jdbc.PreparedStatement.clearBatch(PreparedStatement.java:1051) ~[mysql-connector-java-5.1.49.jar:5.1.49]
	at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1323) ~[mysql-connector-java-5.1.49.jar:5.1.49]
	at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:954) ~[mysql-connector-java-5.1.49.jar:5.1.49]
	at org.apache.flink.connector.jdbc.statement.FieldNamedPreparedStatementImpl.executeBatch(FieldNamedPreparedStatementImpl.java:65) ~[flink-connector-jdbc_2.11-1.13.0-SNAPSHOT.jar:1.13.3]
	at org.apache.flink.connector.jdbc.internal.executor.TableSimpleStatementExecutor.executeBatch(TableSimpleStatementExecutor.java:64) ~[flink-connector-jdbc_2.11-1.13.0-SNAPSHOT.jar:1.13.3]
	at org.apache.flink.connector.jdbc.internal.executor.TableBufferReducedStatementExecutor.executeBatch(TableBufferReducedStatementExecutor.java:101) ~[flink-connector-jdbc_2.11-1.13.0-SNAPSHOT.jar:1.13.3]
	at org.apache.flink.connector.jdbc.internal.JdbcBatchingOutputFormat.attemptFlush(JdbcBatchingOutputFormat.java:219) ~[flink-connector-jdbc_2.11-1.13.0-SNAPSHOT.jar:1.13.3]
	at org.apache.flink.connector.jdbc.internal.JdbcBatchingOutputFormat.flush(JdbcBatchingOutputFormat.java:187) ~[flink-connector-jdbc_2.11-1.13.0-SNAPSHOT.jar:1.13.3]
	at org.apache.flink.connector.jdbc.internal.JdbcBatchingOutputFormat.lambda$open$0(JdbcBatchingOutputFormat.java:131) ~[flink-connector-jdbc_2.11-1.13.0-SNAPSHOT.jar:1.13.3]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_262]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_262]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_262]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_262]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_262]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_262]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]

jdbc的url参数没有设置链接超时情况,通过加入如下参数来调整

autoReconnect=true&maxReconnects=3&initialTimeout=10

你可能感兴趣的:(java,mysql,java,jar)