Trafodion odb 安装及使用

1 什么是odb

odb是一款平台无关的,多线程的,基于ODBC的命令行工具。

Trafodion数据库使用odb来做以下事情:

并行数据加载/抽取

查询驱动

SQL解释器

2 安装配置Trafodion ODBC Driver

(1) 下载unixODBC

[centos@cent-1 clients]$ sudo yum install unixODBC -y

[centos@cent-1 clients]$ ll /etc/odbc*

-rw-r--r--. 1 root root   0 Jul 10  2014 /etc/odbc.ini
-rw-r--r--. 1 root root 575 Jul 10  2014 /etc/odbcinst.ini

(2) 下载Trafodion Client,下载地址:http://apache.fayea.com/incubator/trafodion/apache-trafodion-2.0.1-incubating/apache-trafodion_clients-2.0.1-incubating.tar.gz

(3) 解压安装包,然后解压压缩包TRAF_ODBC_Linux_Driver_64.tar.gz

(4) 在PkgTmp执行安装install.sh文件

[centos@cent-1 clients]$ cd PkgTmp/
[centos@cent-1 PkgTmp]$ ls
connect_test.cpp  libicudata.so.44  libtrafodbc_l64_drvr.so  license.txt  TRAFDSN
install.sh        libicuuc.so.44    libtrafodbc_l64.so       MD5SUM
[centos@cent-1 PkgTmp]$ sudo ./install.sh

3 安装odb

(1) odb压缩已经包含在Trafodion Client安装包中,解压odb64_linux.tar.gz,在bin目录中找到odb64luo

[centos@cent-1 bin]$ ls
odb64luo

(2) 通过如下命令查看odb命令帮助

[centos@cent-1 bin]$ ./odb64luo -h
odb version 1.1.0
Build: linux, amd64, gcc generic m64, uodbc, mreadline, dynamic gzip, dynamic libhdfs, dynamic libxml2 [Jun 24 2016 17:41:59]
   -h: print this help
   -version: print odb version and exit
   -lsdrv: list available drivers @ Driver Manager level
   -lsdsn: list available Data Sources
......

(3) 配置odbc.ini和odbcinst.int文件

[centos@cent-1 bin]$ cat /etc/odbc.ini
[ODBC]
AppUnicodeType=utf16

[traf]
Description                 = Trafodion DSN
Driver                      = Trafodion
Catalog                     = TRAFODION
Schema                      = SEABASE
DataLang                    = 0
FetchBufferSize             = SYSTEM_DEFAULT
Server                      = TCP:192.168.0.16:23400
SQL_ATTR_CONNECTION_TIMEOUT = SYSTEM_DEFAULT
SQL_LOGIN_TIMEOUT           = SYSTEM_DEFAULT
SQL_QUERY_TIMEOUT           = NO_TIMEOUT
ServiceName                 = TRAFODION_DEFAULT_SERVICE
ClientCharSet               = UTF8

[centos@cent-1 odbc]$ cat /etc/odbcinst.ini
# Example driver definitions

# Driver from the trafodion odbc package
# Setup from the unixODBC package
[Trafodion]
Description     = ODBC for Trafodion
Driver64        = /usr/lib64/libtrafodbc_drvr64.so
Setup64         = /usr/lib64/libtrafodbc_drvr64.so
FileUsage       = 1
AppUnicodeType  = utf16
Threading       = 1
ClientCharSet   = UTF8

(4)测试配置是否正确

[centos@cent-1 bin]$ sudo ./odb64luo -lsdrv
PostgreSQL - Description=ODBC for PostgreSQL
MySQL - Description=ODBC for MySQL
Trafodion - Description=ODBC for Trafodion

(5) 测试能否连接到指定数据源

[centos@cent-1 bin]$ sudo ./odb64luo -u trafodion -p traf123 -d traf -i
odb [2016-09-26 06:19:14]: starting ODBC connection(s)... 0
        [odb version 1.1.0]
        Build: linux, amd64, gcc generic m64, uodbc, mreadline, dynamic gzip, dynamic libhdfs, dynamic libxml2 [Jun 24 2016 17:41:59]
        DBMS product name (SQL_DBMS_NAME)            : Trafodion
        DBMS product version (SQL_DBMS_VER)          : 02.01.0000
        Database name (SQL_DATABASE_NAME)            : TRAFODION
        Server name (SQL_SERVER_NAME)                : cent-1.novalocal($Z000PDF){TCP:192.168.0.16/23402:ODBC}
        Data source name (SQL_DATA_SOURCE_NAME)      : traf
        Data source RO (SQL_DATA_SOURCE_READ_ONLY)   : N
        ODBC Driver name (SQL_DRIVER_NAME)           : libtrafodbc64.so
        ODBC Driver version (SQL_DRIVER_VER)         : 03.00.0000
        ODBC Driver level (SQL_DRIVER_ODBC_VER)      : 03.51
        ODBC Driver Manager version (SQL_DM_VER)     : 03.52.0002.0002
        ODBC Driver Manager level (SQL_ODBC_VER)     : 03.52
        Connection Packet Size (SQL_ATTR_PACKET_SIZE): 0
odb [2016-09-26 06:19:14]: exiting. Session Elapsed time 0.070 seconds (00:00:00.070)

4 使用odb

(1) 列出某个schema下面的所有表

[centos@cent-1 bin]$ sudo ./odb64luo -u trafodion -p traf123 -d traf -i t:TRAFODION.SEABASE
odb [2016-09-26 06:28:29]: starting ODBC connection(s)... 0
Connected to Trafodion
SEABASE.T1
odb [2016-09-26 06:28:30]: exiting. Session Elapsed time 0.310 seconds (00:00:00.310)

(2) 列出某个表的DDL语句

[centos@cent-1 bin]$ sudo ./odb64luo -u trafodion -p traf123 -d traf -x "showddl seabase.t1"
odb [2016-09-26 06:40:50]: starting ODBC connection(s)... 0

CREATE TABLE TRAFODION.SEABASE.T1
  (
    ID                               INT DEFAULT NULL SERIALIZED
  )
;
[0.0.0]--- command executed in 4.943s (prep 0.822s, exec 4.119s, fetch 0.002s/0.001s)
odb [2016-09-26 06:40:59]: exiting. Session Elapsed time 8.614 seconds (00:00:08.614)

(3) 更多odb命令请见后续文章…

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

数据源的港湾

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值