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)


你可能感兴趣的:(数据库,ink,DBL)