欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

【Oracle Times Ten】用ttisql从oracle中映射表到timesten

程序员文章站 2022-05-17 18:25:34
...

我感觉timesten比较猛的一点是,可以直接通过ttisql把整个表加载到timesten缓存数据库中。下面是我做的一个例子,分享给大家。1.在oracle中建立一张表“test”。

我感觉timesten比较猛的一点是,可以直接通过ttisql把整个表加载到timesten缓存数据库中。下面是我做的一个例子,香港空间,分享给大家。

1.在oracle中建立一张表“test”。

CREATE TABLE "LION"."TEST" ( "ID" number PRIMARY KEY NOT NULL, "NAME" varchar2(20 byte), "NOTE" varchar2(20 byte), "MARK" varchar2(20 byte) );

2.在这张表中插入500000条数据。

3.映射到timesten中。

(1)连接timesten:

C:\Users\lion>ttisql "DSN=mytt;UID=lion;PWD= ;OraclePWD=orcl"; Copyright (c) 1996-2011, Oracle. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=mytt;UID=lion;PWD= ;OraclePWD=orcl;"; Connection successful: DSN=mytt;UID=lion;DataStore=D:\oracle\timesten\odbc;Datab aseCharacterSet=ZHS16GBK;ConnectionCharacterSet=ZHS16GBK;Temporary=1;DRIVER=D:\o racle\timesten\bin\ttdv1122.dll;LogDir=D:\oracle\timesten\log;TypeMode=0;PLSCOPE _SETTINGS=IDENTIFIERS:NONE;DDLReplicationLevel=1; (Default setting AutoCommit=1)

(2)使用ttisql语句的createandloadfromoraquery命令载入oracle中的root.test表

Command> createandloadfromoraquery test 2 select * from root.test;

(3)稍等几秒钟提示载入成功:

Command> createandloadfromoraquery test 2 select * from root.test; Mapping query to this table: CREATE TABLE "LION"."TEST" ( "ID" number NOT NULL, "NAME" varchar2(20 byte), "NOTE" varchar2(20 byte), "MARK" varchar2(20 byte) ) Table test created 500000 rows loaded from oracle.

注意:如果没有提示成功,香港服务器,而是提示如下信息时,参考我另外一篇博客:《异常处理》

Command> createandloadfromoraquery test 2 select * from root.test; Mapping query to this table: CREATE TABLE "LION"."TEST" ( "ID" number NOT NULL, "NAME" varchar2(20 byte), "NOTE" varchar2(20 byte), "MARK" varchar2(20 byte) ) Table test created 802: Database permanent space exhausted 6220: Permanent data partition free space insufficient to allocate 33296 bytes of memory The command failed.

(4)使用ttisql查询导入timesten的test表数据:

Command> select count(*) from test; 1 row found. Command> select * from test where id 20 rows found.

(5)使用java调用timesten查询刚刚导入的test表(如果有兴趣查看源代码,香港服务器,可以看我另外一篇博客:Java连接Times Ten)

【Oracle Times Ten】用ttisql从oracle中映射表到timesten


本文出自 “java之路” 博客,请务必保留此出处