码迷,mamicode.com
首页 > 数据库 > 详细

KingbaseES的DBLink创建

时间:2015-03-09 19:25:47      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:数据库

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

KingbaseES的DBLink创建

标签:数据库

原文地址:http://suifu.blog.51cto.com/9167728/1618574

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!