1、找到timesten配置文件:

[timesten@trgxtts info]$ ttVersion
TimesTen Release 11.2.2.8.0 (64 bit Linux/x86_64) (tt1122:53396) 2015-01-20T08:36:31Z
  Instance admin: timesten
  Instance home directory: /home/timesten/TimesTen/tt1122
  Group owner: ttadmin
  Daemon home directory: /home/timesten/TimesTen/tt1122/info
  PL/SQL enabled.
[timesten@trgxtts info]$ cd /home/timesten/TimesTen/tt1122/info
[timesten@trgxtts info]$ ls
cluster.oracle.ini  snmp.ini           timestend.pid       tterrors.log
DBI5af94776.2       sys.odbc.ini       ttcacheadvisor      ttmesg.log
DemoDataStore       sys.ttconnect.ini  ttendaemon.options
[timesten@trgxtts info]$ vi sys.odbc.ini

2、对sys.odbc.ini新增如下内容:

[timesten@trgxtts info]$ vi sys.odbc.ini
[ODBC Data Sources]
mydb_CS=TimesTen 11.2.2 Client Driver

[mydb_CS]
TTC_SERVER=mydb_test
TTC_SERVER_DSN=TT1122_new
UID=scott

[mydb_CS]跟[ODBC Data Sources]中mydb_CS一致。

TTC_SERVER跟sys.ttconnect.ini中[mydb_test]一致,这里只是在客户端odbc里面定义一个名称,具体服务端ip和端口,见客户端另一个ttconnect.ini配置文件。

TTC_SERVER_DSN跟sys.odbc.ini中一个可用的DSN一致(是服务端的一个可用的dsn)。

UID是上面的DSN对应的数据库的一个用户。

3、在timesten数据库中新增用户scott

ttisql TT1122_new
create user scott identified by tiger ;
grant connect,admin to scott ;

这部分内容见博客:

https://blog.csdn.net/kadwf123/article/details/80311469

4、配置客户端数据源:

查看服务器端服务端口:

[timesten@trgxtts info]$ ttstatus
TimesTen status report as of Tue May 15 10:45:28 2018

Daemon pid 2281 port 53396 instance tt1122
TimesTen server pid 2290 started on port 53397
------------------------------------------------------------------------
Data store /tmp/tt1122_new/TT1122_new
There are no connections to the data store
Replication policy  : Manual
Cache Agent policy  : Manual
PL/SQL enabled.
------------------------------------------------------------------------
Accessible by group ttadmin
End of report

关注这句:

TimesTen server pid 2290 started on port 53397

配置客户端数据源,新增如下内容:

[timesten@trgxtts info]$ vi sys.ttconnect.ini 
[mydb_test]
Description=TimesTen Server
Network_Address=10.45.11.93
TCP_PORT=53397

ip就是timesten服务器的ip地址,端口是timesten服务器的监听端口,ttstatus查出来的。[mydb_test]自己定义。

5、使用客户端连接测试:

[timesten@trgxtts info]$ ttisqlcs mydb_CS

Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.



connect "DSN=mydb_CS";
Enter password for 'scott': 
Connection successful: DSN=mydb_CS;TTC_SERVER=mydb_test;TTC_SERVER_DSN=TT1122_new;UID=scott;DATASTORE=/tmp/tt1122_new/TT1122_new;DATABASECHARACTERSET=US7ASCII;CONNECTIONCHARACTERSET=US7ASCII;TYPEMODE=0;
(Default setting AutoCommit=1)
Command> select * from timesten.newtab ;
< 10 >
1 row found.
Command> 

Logo

更多推荐