你好 参考官网 https://ci.apache.org/projects/flink/flink-docs-release-1.12/zh/dev/table/connectors/jdbc.html
这边读取mysql jdbc数据报错Exception in thread "main" org.apache.flink.table.api.TableException: Only insert statement is supported now. String a = "-- register a MySQL table 'users' in Flink SQL\n" + "CREATE TABLE MyUserTable (\n" + " id BIGINT\n" + ") WITH (\n" + " 'connector' = 'jdbc',\n" + " 'url' = 'jdbc:mysql://***:3306/monitor',\n" + " 'table-name' = 't1',\n" + " 'username' = 'root',\n" + " 'password' = '***'\n" + ") "; String b ="-- scan data from the JDBC table\n" + "SELECT id FROM MyUserTable\n"; tEnv.executeSql(a); 请问是不可以从mysql读取数据吗? |
可以读取的,还有内置flink cdc
select得用query方法,看看是不是用错了execute。 ---原始邮件--- 发件人: "air23"<[hidden email]> 发送时间: 2021年3月30日(周二) 上午10:25 收件人: "user-zh"<[hidden email]>; 主题: flink 从mysql读取数据异常 你好 参考官网 https://ci.apache.org/projects/flink/flink-docs-release-1.12/zh/dev/table/connectors/jdbc.html 这边读取mysql jdbc数据报错Exception in thread "main" org.apache.flink.table.api.TableException: Only insert statement is supported now. String a = "-- register a MySQL table 'users' in Flink SQL\n" + "CREATE TABLE MyUserTable (\n" + " id BIGINT\n" + ") WITH (\n" + " 'connector' = 'jdbc',\n" + " 'url' = 'jdbc:mysql://***:3306/monitor',\n" + " 'table-name' = 't1',\n" + " 'username' = 'root',\n" + " 'password' = '***'\n" + ") "; String b ="-- scan data from the JDBC table\n" + "SELECT id FROM MyUserTable\n"; tEnv.executeSql(a); 请问是不可以从mysql读取数据吗? |
这边是想离线读取。不是走实时的
看到异常是 Only insert statement is supported now 在 2021-03-30 10:31:51,"guoyb" <[hidden email]> 写道: >可以读取的,还有内置flink cdc >select得用query方法,看看是不是用错了execute。 > > > >---原始邮件--- >发件人: "air23"<[hidden email]> >发送时间: 2021年3月30日(周二) 上午10:25 >收件人: "user-zh"<[hidden email]>; >主题: flink 从mysql读取数据异常 > > >你好 参考官网 https://ci.apache.org/projects/flink/flink-docs-release-1.12/zh/dev/table/connectors/jdbc.html >这边读取mysql jdbc数据报错Exception in thread "main" org.apache.flink.table.api.TableException: Only insert statement is supported now. > > >String a = "-- register a MySQL table 'users' in Flink SQL\n" + >"CREATE TABLE MyUserTable (\n" + >" id BIGINT\n" + >") WITH (\n" + >" 'connector' = 'jdbc',\n" + >" 'url' = 'jdbc:mysql://***:3306/monitor',\n" + >" 'table-name' = 't1',\n" + >" 'username' = 'root',\n" + >" 'password' = '***'\n" + >") "; > >String b ="-- scan data from the JDBC table\n" + >"SELECT id FROM MyUserTable\n"; > >tEnv.executeSql(a); > > > >请问是不可以从mysql读取数据吗? |
Hi,air23
JDBCTableSource就是batch模式的,不走实时。Flink解析执行计划时内部会去判断。 Best air23 wrote > 这边是想离线读取。不是走实时的 > 看到异常是 Only insert statement is supported now > > > > > > > > > > > > > > > > > > 在 2021-03-30 10:31:51,"guoyb" < > 861277329@ >> 写道: >>可以读取的,还有内置flink cdc >>select得用query方法,看看是不是用错了execute。 >> >> >> >>---原始邮件--- >>发件人: "air23"< > wangfei23_job@ > &gt; > >发送时间: 2021年3月30日(周二) 上午10:25 >>收件人: "user-zh"< > user-zh@.apache > &gt;; > >主题: flink 从mysql读取数据异常 >> >> >>你好 参考官网 https://ci.apache.org/projects/flink/flink-docs-release-1.12/zh/dev/table/connectors/jdbc.html >>这边读取mysql jdbc数据报错Exception in thread "main" org.apache.flink.table.api.TableException: Only insert statement is supported now. >> >> >>String a = "-- register a MySQL table 'users' in Flink SQL\n" + >>"CREATE TABLE MyUserTable (\n" + >>" id BIGINT\n" + >>") WITH (\n" + >>" 'connector' = 'jdbc',\n" + >>" 'url' = 'jdbc:mysql://***:3306/monitor',\n" + >>" 'table-name' = 't1',\n" + >>" 'username' = 'root',\n" + >>" 'password' = '***'\n" + >>") "; >> >>String b ="-- scan data from the JDBC table\n" + >>"SELECT id FROM MyUserTable\n"; >> >>tEnv.executeSql(a); >> >> >> >>请问是不可以从mysql读取数据吗? -- Sent from: http://apache-flink.147419.n8.nabble.com/ |
Free forum by Nabble | Edit this page |