Closed MoonBottle closed 1 year ago
不建议直接使用mysql驱动连接Doris。 用restful试试?
restful 我没有找到查询的,只看到一个 Stream Load 导入的 api
我想实现在程序里查询和增量写入数据到 doris,下面是我现在在尝试的测试代码
如果不行的话我是不是要起动一个代理服务连接 doris,暴露 restful 接口来供程序调用
@Bean
public R2dbcEntityTemplate r2dbcEntityTemplate( ) {
MySqlConnectionConfiguration configuration = MySqlConnectionConfiguration.builder()
.host("172.26.6.144")
.port(9030)
.user("root")
.database("demo")
.build();
ConnectionFactory connectionFactory = MySqlConnectionFactory.from(configuration);
return new R2dbcEntityTemplate(connectionFactory);
}
UserService
@RequiredArgsConstructor
@Service
public class UserService implements CommandLineRunner {
private final R2dbcEntityTemplate r2dbcEntityTemplate;
@Override
public void run(String... args) throws Exception {
extracted().subscribe();
}
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public Flux<ExampleTbl> extracted() {
return r2dbcEntityTemplate.select(ExampleTbl.class)
.all()
.doOnNext(el -> System.out.println(JSON.toJSONString(el)));
}
}
抱歉抱歉,我没仔细阅读文档,找到 restful 接口了。 不过还是想请教下,为什么不建议 myql 驱动直连 doris 呢?
抱歉抱歉,我没仔细阅读文档,找到 restful 接口了。
不过还是想请教下,为什么不建议 myql 驱动直连 doris 呢?
doris只是适配了mysql协议,但是不一定完全适配了。个人觉得走restful应该更靠谱吧。
有道理,多谢周佬指教!
环境
java: 1.8.0_131 hsweb: 4.0.16
问题说明
我使用 r2dbc-mysql 创建了一个连接 doris,在使用中发现发生了下面的异常
debug 发现是下面的 sql 报错,估计是事务导致的,想问下有什么方法,让 r2dbc-mysql 创建的连接,不走事务么?