- 验证环境
KADB版本:Greenplum Database 6.0.0 build dev.V003R002C001B0181.d354cc9215
KES版本:KingbaseES V008R006C007B0012
- DBLINK环境准备
- KES创建用户
KES修改参数,在kingbase.conf文件中,设置
password_encryption = md5
登录配置文件sys_hba.conf修改登录验证方式为md5
创建用户
test=# show password_encryption;
password_encryption
---------------------
md5
(1 row)文章来源地址https://www.toymoban.com/news/detail-823217.html
test=# create user u2 with password '12345';
CREATE ROLE
- KADB在数据库中创建dblink扩展
CREATE EXTENSION dblink;
- KADB访问KES查询、插入数据
- KADB创建命名连接
test=# SELECT dblink_connect('kingbase','host=192.168.85.133 port=54321 dbname=test user=u2 password=12345');
dblink_connect
----------------
OK
(1 row)
- 查询数据
test=# SELECT * FROM dblink('kingbase', 'SELECT * FROM u2') AS dbltab(a int,b varchar(20));
a | b
---+-----------
1 | ccccccccc
2 | dddddd
2 | dddddd
2 | dddddd
(4 rows)
- 插入数据
test=# SELECT dblink_exec('kingbase', 'insert into u2 values(''3'',''this is test'')',false);
dblink_exec
-------------
INSERT 0 1文章来源:https://www.toymoban.com/news/detail-823217.html
(1 row)
到了这里,关于【无标题】KADB使用DBLINK连接KES验证的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!