首页 > 解决方案 > kafka-connect JDBC PostgreSQL Sink Connector 显式定义 PostgrSQL 模式(命名空间)

问题描述

我正在使用 JDBC 接收器连接器将数据写入 postgresql。

连接器工作正常,但似乎连接器只能将数据写入名为的默认 postgresql 模式public

这是 postgresql 的常见 JDBC URL 格式。

jdbc:postgresql://<host>:<port5432>/<database>

是否可以明确定义我需要 postgresql 接收器连接器写入的模式名称?

更新

谢谢@Laurenz Albe 的提示。我可以search_path在 jdbc 连接 URL 中定义,如下所示:

jdbc:postgresql://<host>:<port>/<database>?options=-c%20search_path=myschema,public

jdbc:postgresql://<host>:<port>/<database>?currentSchema=myschema

标签: postgresqljdbcapache-kafka-connect

解决方案


使用options连接参数设置search_path

jdbc:postgresql://<host>:<port5432>/<database>?options=-c%20search_path=myschema,public

推荐阅读