您好,欢迎访问一九零五行业门户网

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

我感觉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;databasecharacterset=zhs16gbk;connectioncharacterset=zhs16gbk;temporary=1;driver=d:\oracle\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 created500000 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 bytesof memorythe command failed.(4)使用ttisql查询导入timesten的test表数据:
command> select count(*) from test;1 row found.command> select * from test where id20 rows found.(5)使用java调用timesten查询刚刚导入的test表(如果有兴趣查看源代码,香港服务器,可以看我另外一篇博客:java连接times ten)
本文出自 “java之路” 博客,请务必保留此出处
其它类似信息

推荐信息