时间:2021-07-01 10:21:17 帮助过:3人阅读
在客户端我们不定义DSN,然后使用ttisqlcs连接,注意是ttisqlcs而非ttisql。这也说明此法只适用于C/S连接而非direct连接。
$ ttisqlcs "ttc_server=localhost;tcp_port=53393;ttc_server_dsn=sampledb_1122;uid=tthr;pwd=timesten"
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "ttc_server=localhost;tcp_port=53393;ttc_server_dsn=sampledb_1122;uid=tthr;pwd=timesten";
Connection successful: DSN=;TTC_SERVER=localhost;TTC_SERVER_DSN=sampledb_1122;UID=tthr;DATASTORE=/home/oracle/TimesTen/tt1122/info/DemoDataStore/sampledb_1122;DATABASECHARACTERSET=US7ASCII;CONNECTIONCHARACTERSET=US7ASCII;PERMSIZE=40;TEMPSIZE=32;TYPEMODE=0;
(Default setting AutoCommit=1)
Command> exit
实际上用到的三个属性为:ttc_server,tcp_port,ttc_server_dsn。
注意tcp_port是TimesTen 服务器的PID,而非TimesTen守护进程的PID。
由于只涉及到连接字符串,因此只需要将在 的源程序中的
String URL = "jdbc:timesten:direct:DSN=sampledb_1122;uid=tthr;pwd=timesten";
改为
String URL = "jdbc:timesten:client:ttc_server=localhost;tcp_port=53393;ttc_server_dsn=sampledb_1122;uid=tthr;pwd=timesten";
即可。
改动前的JAVA源程序参见:
极简Java连接TimesTen程序
HOWTO : create a TimesTen JDBC client server connection without using the sys.odbc.ini and sys.ttconnect.ini client configuration files (Doc ID 1311810.1)
开发者和DBA-不通过DSN连接TimesTen
标签: