flink例子-读取数据库
发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,private final static Logger logger = LoggerFactory.getLogger(GetData.class); public static void m
千家信息网最后更新 2025年12月02日flink例子-读取数据库
private final static Logger logger = LoggerFactory.getLogger(GetData.class); public static void main(String[] arg) throws Exception { TypeInformation[] fieldTypes = new TypeInformation[] { BasicTypeInfo.STRING_TYPE_INFO }; RowTypeInfo rowTypeInfo = new RowTypeInfo(fieldTypes); JDBCInputFormat jdbcInputFormat = JDBCInputFormat.buildJDBCInputFormat() .setDrivername("com.mysql.jdbc.Driver") .setDBUrl("jdbc:mysql://ip:3306/tablename?characterEncoding=utf8") .setUsername("*") .setPassword("*") .setQuery("select name from words") .setRowTypeInfo(rowTypeInfo) .finish(); final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSource s = env.createInput(jdbcInputFormat); // datasource BatchTableEnvironment tableEnv = new BatchTableEnvironment(env, TableConfig.DEFAULT()); tableEnv.registerDataSet("t2", s); tableEnv.sqlQuery("select * from t2").printSchema(); Table query = tableEnv.sqlQuery("select * from t2"); DataSet result = tableEnv.toDataSet(query, Row.class); result.print(); System.out.println(s.count());}通过插件将所需的类打到一个jar中
maven-assembly-plugin false jar-with-dependencies * make-assembly package assembly 然后执行
./bin/flink run /flink-1.8.0/collector-api-0.1.jar
插件
例子
数据
数据库
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
人工智能网络安全常识
网络技术员年度计划怎么写
2019网络安全行业全景图
配置yum源服务器
我的世界服务器一直卡在定位服务
数据库怎么抽取另一个数据库的表
数据库 not in用法
服务器的名字
云南师范大学检索数据库
云游戏 gpu 服务器市场
forest怎么转到全球服务器
网络安全广州
网络安全信息收集的方法
达梦数据库启动服务后端口没打开
英特尔 服务器
荣耀服务器蓝屏代码
接入层网络安全问题有哪些
学网络技术的工作
mc服务器如何给管理
wifi连接光猫服务器
网络技术开发图片
电脑软件开发招聘
我的世界基岩版服务器管理
Nacos数据库作用
晋宁区软件开发咨询报价
昭通辰庆互联网科技有限公司
家庭私有云服务器原理是什么
无线网络安全硬件
通信网络技术的介绍
mysql数据库合同