发表于: 2006.07.09 16:25
分类: TIMESTEN
出处: http://yangtingkun.itpub.net/post/468/131748
---------------------------------------------------------------
这个例子是配置linux/unix平台下,设置了Access Control的情况。
安装了Oracle9204的数据库服务器。Timesten在linux环境下以非root身份安装,并设置了Access Control。
在登陆目录下设置一个.odbc.ini参数文件,内容如下:
[ODBC Data Sources]
mytimesten=TimesTen 6.0 Driver
[cache]
DataStore=/home/oracle/TimesTen/tt60/store/store
DurableCommits=0
PermSize=16
OracleID=member
UId=ndmain
OraclePwd=ndmain
[admin]
DataStore=/home/oracle/TimesTen/tt60/store/store
DurableCommits=0
PermSize=16
UId=oracle
建立好DSN文件,首先以管理员用户登陆,建立连接到Oracle的用户,并授权:
[oracle@member oracle]$ ttisql admin
Copyright (c) 1996-2006, Oracle. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
All commands must end with a semicolon character.
connect "DSN=admin";
Connection successful: DSN=admin;UID=oracle;DataStore=/home/oracle/TimesTen/tt60/store/store;PermSize=16;
(Default setting AutoCommit=1)
Command> create user ndmain identified by 'ndmain';
Command> grant admin, ddl to ndmain;
注意密码必须用单引号引起来,这点上和Oracle的语法上有差别。
建立好环境后,直接使用ndmain用户连接到timesten数据库:
Command> connect cache
> ;
Enter password for 'ndmain':
Connection successful: DSN=cache;UID=ndmain;DataStore=/home/oracle/TimesTen/tt60/store/store;OracleId=member;PermSize=16;
(Default setting AutoCommit=1)
cache: Command> autocommit 0;
cache: Command> call ttcacheuidpwdset('ndmain', 'ndmain');
cache: Command> call ttcachestart();
cache: Command> create readonly cache group testcache autorefresh interval 5 seconds
> from t (id int primary key, line int);
cache: Command> load cache group testcache commit every 100 rows;
5034: The operation must be executed within its own transaction
The command failed.
这里和Oracle有点不同,对于Oracle来说,所有的CREATE语句都是DDL,而所有的DDL都是会自动提交的。这里还需要明确的提交,看来在DDL处理方面Timesten和Oracle也有一定的差别。
cache: Command> commit;
cache: Command> load cache group testcache commit every 100 rows;
334022 rows affected.
cache: Command> select count(*) from t;
5046: Commit/rollback required after Cache Group statement
The command failed.
cache: Command> commit;
cache: Command> select count(*) from t;
< 334022 >
1 row found.
后面这些和Windows环境下的例子就比较类似了,二者主要的区别在于连接Oracle的用户的设置以及DSN的配置。











