先在sysodbcini配置一个DSN
#######################################################
[ttdemo]
Driver=/opt/TimesTen/tt/lib/libttenso
DataStore=/var/TimesTen/tmp/ttdemo
DatabaseCharacterSet=WEISOP
TempSize=
PermSize=
Authenticate=
UID=test
OracleID=shacola
OraclePwd=
Logging=
Isolation=
PassThrough=
LockLevel=
TypeMode=
#######################################################
创建Oracle测试表并准备数据
sqlplus test/
CREATE TABLE readtab (a NUMBER NOT NULL PRIMARY KEY b VARCHAR());
INSERT INTO readtab VALUES ( hello);
INSERT INTO readtab VALUES ( world);
COMMIT;
创建 cache group
ttisql ttdemo
call ttCacheUidPwdSet(test);
call ttCacheStart;
CREATE READONLY CACHE GROUP readcache
AUTOREFRESH INTERVAL SECONDS
FROM readtab
(a NUMBER NOT NULL PRIMARY KEY b VARCHAR());
装载数据
LOAD CACHE GROUP readcache COMMIT EVERY ROWS;
SELECT * FROM readtab;
在源表里插入新的数据
sqlplus test/
INSERT INTO readtab VALUES ( Hello);
INSERT INTO readtab VALUES ( Again);
COMMIT;
检查cache是否刷新
需要等待AUTOREFRESH INTERVAL 指定的时间本例中是秒
测试完毕 打扫一下
DROP CACHE GROUP readcache;
call ttCacheStop;