KingbaseES的DBLink创建

创建一个KDB库,建立dblink,需要在KDB库内访问KINGBASE库中的数据;

 

 

KINGBASE=#CREATE DATABASE KDB

[kingbase@localhost config]$ vim sys_dblink.conf

[kingbase]
DriverType=ODBC
DriverName="KingbaseES
7 ODBC Driver"
Host=127.0.0.1
Port=54321
dbname=KINGBASE
#dbname=REGRESSION
ExtendedProperties="UseServerCursor=1;Fetch=1000"

 

CREATE TABLE tb1(col1 INT, col2 CHAR(10), col3 TIMESTAMP);
CREATE TABLE tb2(col2 BIGINT, col3 VARCHAR(10), col4 BOOL);
INSERT INTO tb1 VALUES(100, ‘char‘, current_timestamp);
INSERT INTO tb2 VALUES(100, ‘varchar‘, ‘t‘);

KINGBASE=# SELECT * FROM tb1;

 COL1 |    COL2    |            COL3           

------+------------+----------------------------

  100 | char       | 2014-09-18 19:33:19.401817

(1 row)

 

KDB=# CREATE PUBLIC DATABASE LINK KINGBASE CONNECT TO ‘SYSTEM‘ IDENTIFIED BY ‘beijing‘ USING ‘kingbase‘; 

KDB=# SELECT * FROM tb1@kingbase;

 COL1 |    COL2    |            COL3           

------+------------+----------------------------

  100 | char       | 2014-09-18 19:33:19.401817

(1 row)


本文出自 “岁伏” 博客,请务必保留此出处http://suifu.blog.51cto.com/9167728/1618574

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。