创建一个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