odb是一款平台无关的,多线程的,基于ODBC的命令行工具;Trafodion数据库使用odb来做以下事情:并行数据加载/抽取、查询驱动、SQL解释器;
[root@test01 software]# tar -zxf QianBase_clients-1.6.2-RH7-x86_64.tar.gz [root@test01 software]# cd clients [root@test01 clients]# ls EsgynDB-ADO.NET-2.7.0.exe LICENSE_Esgyn TFODBC32-2.7.0.exe TRAFODB-2.7.0.exe jdbcT4-1.6.2.zip NOTICE TFODBC64-2.7.0.exe TRAF_ODBC_Linux_Driver_64-2.7.0.tar.gz LICENSE odb64_linux-2.7.0.tar.gz trafci.zip [root@test01 clients]# tar -zxf odb64_linux-2.7.0.tar.gz [root@test01 clients]# ls bin LICENSE odb64_linux-2.7.0.tar.gz TFODBC64-2.7.0.exe TRAF_ODBC_Linux_Driver_64-2.7.0.tar.gz EsgynDB-ADO.NET-2.7.0.exe LICENSE_Esgyn README trafci.zip jdbcT4-1.6.2.zip NOTICE TFODBC32-2.7.0.exe TRAFODB-2.7.0.exe [root@test01 clients]# cd bin/ [root@test01 bin]# ll total 824 -rwxr-xr-x 1 root root 842088 Jul 14 13:24 odb64luo [root@test01 bin]# pwd /opt/software/clients/bin [root@test01 bin]# vi /etc/profile ## 在全局环境变量中添加以下环境变量 export PATH=/opt/software/clients/bin:$PATH [root@test01 bin]# source /etc/profile [root@test01 bin]# cd [root@test01 ~]#
odb是通过ODBC接口连接数据库的,EsgynDB(trafodion)ODBC接口配置见http://blog.itpub.net/69985104/viewspace-2743483/
[root@test01 ~]# odb64luo -u db__root -d traf -i
Password:
odb [2020-12-23 14:36:20]: starting ODBC connection(s)... 0
[odb version 1.1.0]
Build: linux, amd64, gcc generic m64, uodbc, mreadline, dynamic gzip, dynamic libhdfs, dynamic libxml2 [Jul 14 2020 05:24:25]
DBMS product name (SQL_DBMS_NAME) : Trafodion
DBMS product version (SQL_DBMS_VER) : 02.07.0002
Database name (SQL_DATABASE_NAME) : TRAFODION
Server name (SQL_SERVER_NAME) : test03($Z00010001EQ){TCP:10.12.40.13/23422: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.0003
ODBC Driver Manager level (SQL_ODBC_VER) : 03.52
Connection Packet Size (SQL_ATTR_PACKET_SIZE): 0
odb [2020-12-23 14:36:24]: exiting. Session Elapsed time 3.622 seconds (00:00:03.622)
[root@test01 ~]#
[root@test01 ~]# cat odb_test_data.txt 1,北京 2,上海 3,贵阳
SQL>create table odb_test(a int,b varchar(20)); --- SQL operation complete.
[root@test01 ~]# odb64luo -u db__root -d traf -l src=odb_test_data.txt:tgt=trafodion.seabase.ODB_TEST:fs=,:rows=1 Password: odb [2020-12-23 14:49:48]: starting ODBC connection(s)... 0 Connected to Trafodion [0] 1 records inserted [commit] [0] 2 records inserted [commit] [0] 3 records inserted [commit] [0] odb version 1.1.0 Load(2) statistics: [0] Target table: TRAFODION.SEABASE.ODB_TEST [0] Source: odb_test_data.txt [0] Pre-loading time: 5.239 s (00:00:05.239) [0] Loading time: 0.083 s(00:00:00.083) [0] Total records read: 3 [0] Total records inserted: 3 [0] Total number of columns: 2 [0] Total bytes read: 27 [0] Average input row size: 9.0 B [0] ODBC row size: 91 B (data) + 16 B (len ind) [0] Rowset size: 1 [0] Rowset buffer size: 0.10 KiB [0] Load throughput (real data): 0.318 KiB/s [0] Load throughput (ODBC): 3.212 KiB/s odb [2020-12-23 14:49:53]: exiting. Session Elapsed time 5.328 seconds (00:00:05.328)
SQL>SELECT * FROM ODB_TEST; A B ----------- -------------------------------------------------------------------------------- 1 北京 2 上海 3 贵阳 --- 3 row(s) selected.
oracleODBC配置见:http://blog.itpub.net/69985104/viewspace-2744740/
SQL> create table odb_t1(a int,b varchar(20)); Table created. SQL> insert into odb_t1 values(4,'重庆'); 1 row created. SQL> insert into odb_t1 values(5,'成都'); 1 row created. SQL> select * from odb_t1; A B ---------- ------------------------------------------------------------ 4 重庆 5 成都
[root@test01 ~]# odb64luo -u pubuser:db__root -p pubu123:123qwe -d oracle:traf -cp src="odb_t1":tgt=seabase.ODB_TEST:rows=1; Connected to Oracle odb [2020-12-23 16:04:13]: starting ODBC connection(s)... 0 >1 >2 Connected to Trafodion [1] 1 records copied [commit] [2] 1 records copied [commit] [0] odb version 1.1.0 Copy statistics: [0] Source: ODB_T1 [0] Target: seabase.ODB_TEST [0] Total number of columns: 2 [0] ODBC row size: 62 B (data) + 16 B (len ind) [0] Rowset size: 1 [0] Rowset buffer size: 0.08 KiB [0] Pre-copy time: 0.884 s (00:00:00.884) [0] Copy time: 0.034 s (00:00:00.034) [0] Total records copied: 2 (0.059 krec/s) [0] Copy throughput (ODBC): 0.003 MiB/s (0.012 GiB/h) [0] Total/Wait cycles: 2/0 [0>1] 1 records copied in 0.033 (00:00:00.033 s) [0>2] 1 records copied in 0.034 (00:00:00.034 s) odb [2020-12-23 16:04:14]: exiting. Session Elapsed time 0.943 seconds (00:00:00.943)
SQL>SELECT * FROM ODB_TEST; A B ----------- -------------------------------------------------------------------------------- 5 成都 1 北京 2 上海 3 贵阳 4 重庆 --- 5 row(s) selected.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69985104/viewspace-2744729/ ,如需转载,请注明出处,否则将追究法律责任。