TimesTen1122配置客户端连接

1、配置TNS

在使用TT客户端之前需要安装oracle客户端,配置好连接oracle数据库的TNS

FYL_TT =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.99)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = fyl)
    )
  )
测试
[oracle@db1 admin]$ sqlplus scott@fyl_tt/tiger

2、安装TT客户端软件

[oracle@db1 linux8664]$ ./setup.sh 

ERROR: The /etc/TimesTen directory needs to be created for the instance registry
       and its ownership and permissions set appropriately.
       Please refer to the installation guide for assistance.

[oracle@db1 linux8664]$ 
[oracle@db1 linux8664]$ 
[oracle@db1 linux8664]$ ./setup.sh 

NOTE: Each TimesTen installation is identified by a unique instance name.
      The instance name must be a non-null alphanumeric string, not longer
      than 255 characters.

Please choose an instance name for this installation? [ tt1122 ] 
Instance name will be 'tt1122'.
Is this correct? [ yes ] 

Of the three components:

  [1] Client/Server and Data Manager
  [2] Data Manager Only
  [3] Client Only

Which would you like to install? [ 1 ] 3

Of the following options :

  [1] /home/oracle
  [2] /soft
  [3] Specify a location
  [q] Quit the installation

Where would you like to install the tt1122 instance of TimesTen? [ 1 ] 3
Please specify a directory to install TimesTen? [ /home/oracle ] /u02
Installing into /u02/TimesTen/tt1122 ...
Creating /u02/TimesTen/tt1122 ...
Uncompressing ...

NOTE: For security, we recommend that you restrict access to the
      TimesTen installation to members of a single OS group. Only members of
      that OS group will be allowed to perform direct mode connections to
      TimesTen, and only members of that OS group will be allowed to perform
      operations that access TimesTen data stores, TimesTen files and shared
      memory. The OS group defaults to the primary group of the instance
      administrator. You can default to this group, choose another OS group
      or you can make this instance world-accessible. If you choose to make
      this instance world-accessible, all database files and shared memory
      are readable and writable by all users.

Restrict access to the the TimesTen installation to the group 'oinstall'? [ yes ] 
      TNS_ADMIN was not set in your environment but there is a tnsnames.ora
      file in /u01/app/oracle/product/11.2.0/db_1/network/admin.
Would you like to use this TNS_ADMIN setting for the Oracle TimesTen Application-Tier Database Cache? [ yes 

] 

TNS_ADMIN will be set to /u01/app/oracle/product/11.2.0/db_1/network/admin
You can change TNS_ADMIN later by running <install_dir>/bin/ttmodinstall.



NOTE: It appears that you are running version 4 or higher of the g++
      compiler. TimesTen ships with multiple sets of client libraries and server
      binaries : one built for compatibility with g++ 3.4.6 and one with
      g++ 4.1.0. The installer has created links to the 4.1.0 library in the
      <install_dir>/lib directory and to the 4.1.0 server binary in the
      <install_dir>/bin directory. If you want to use a different compiler,
      please modify the links to point to the desired library and server binary.

Do you want to install the Quick Start Sample Programs and the TimesTen Documentation? [ no ] 
Would you like to install the documentation (without the Quick Start Sample Programs)? [ yes ] 
Where would you like to create the doc directory? [ /u02/TimesTen/tt1122/doc ] 
The TimesTen documentation has been installed in /u02/TimesTen/tt1122/doc.
Installing client components ...
What is the name of the host running the TimesTen server? [ db1 ] 
What is the TCP/IP port number that the TimesTen server is listening on? [ 53397 ] 
The 11.2.2.8 Release Notes are located here :
  '/u02/TimesTen/tt1122/README.html'

End of TimesTen installation.
3、配置客户端数据源

查看服务器端服务端口
[oracle@fyl admin]$ ttstatus|grep "TimesTen server"
TimesTen server pid 2401 started on port 53397
配置客户端数据源
[oracle@db1 info]$ vi sys.ttconnect.ini 

[mydb_test]
Description=TimesTen Server
Network_Address=192.168.6.99
TCP_PORT=53397

[oracle@db1 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=mydb
UID=scott
4、测试

[oracle@db1 bin]$ ./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=mydb;UID=scott;DATASTORE=/u02/TimesTen/oradata/mydb;DATABAS

ECHARACTERSET=ZHS16GBK;CONNECTIONCHARACTERSET=US7ASCII;PERMSIZE=60;TEMPSIZE=40;TYPEMODE=0;ORACLENETSERVICEN

AME=fyl;
(Default setting AutoCommit=1)
Command> tables;
  SCOTT.DEPT
1 table found.
Command> select * from dept;
< 10, ACCOUNTING, NEW YORK >
< 20, RESEARCH, DALLAS >
< 30, SALES, CHICAGO >
< 40, OPERATIONS, BOSTON >
4 rows found.




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: MyBatis 是一个流行的 Java 持久化框架,可以用于操作多种数据库。要使用 MyBatis 操作 Oracle TimesTen 数据库,需要进行一些配置和设置。下面是一些基本步骤: 1. 添加 TimesTen 的 JDBC 驱动程序。可以从 TimesTen 官方网站下载,并将其放置在项目的 classpath 中。 2. 配置 MyBatis 的数据源,指定 TimesTen 的 JDBC 驱动程序、连接 URL、用户名和密码等信息。可以在 MyBatis 的配置文件中进行配置。 例如: ``` <dataSource type="POOLED"> <property name="driver" value="com.timesten.jdbc.Driver"/> <property name="url" value="jdbc:timesten:direct:dsn=sampledb_1122;uid=appuser;pwd=apppassword"/> </dataSource> ``` 3. 配置 MyBatis 的 SQL 映射文件,定义需要执行的 SQL 语句和参数映射等信息。可以使用 MyBatis 提供的语法或者自定义 SQL 语句。 例如: ``` <select id="getUserById" parameterType="java.lang.Long" resultType="User"> SELECT * FROM users WHERE id = #{id} </select> ``` 4. 在 Java 代码中使用 MyBatis 的 SqlSession 来执行 SQL 语句。 例如: ``` SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(configuration); SqlSession session = sessionFactory.openSession(); User user = session.selectOne("getUserById", 1L); session.close(); ``` 以上是一些基本的步骤,可以根据具体情况进行调整和修改。注意,TimesTen 和 Oracle 数据库之间有些许的差异,需要注意一些细节和配置。 ### 回答2: MyBatis是一款流行的Java持久化框架,它支持许多不同类型的数据库,包括Oracle TimesTen。使用MyBatis进行Oracle TimesTen的操作需要一些配置和步骤。 首先,我们需要在MyBatis的配置文件中设置数据源。可以使用TimesTen提供的JDBC驱动程序来配置数据源,类似于配置其他类型的数据库连接。 接下来,我们需要定义我们想要操作的表和实体类的映射关系。在MyBatis中,我们可以使用XML或注解来定义映射。我们需要指定实体类的属性与表的列之间的对应关系,并定义相应的SQL语句。 在进行具体的数据库操作之前,我们可以创建一个会话工厂对象。会话工厂是MyBatis的核心对象之一,它负责创建会话对象。会话是真正执行数据库操作的地方。 通过会话对象,我们可以执行SQL语句,例如插入、更新、删除或查询数据。我们可以使用定义好的映射关系和SQL语句来操作数据库,并通过会话对象获取操作结果或数据。 在使用MyBatis操作Oracle TimesTen时,我们可以利用MyBatis提供的许多高级特性,例如动态SQL、缓存和批处理等,来提高性能和灵活性。 总结而言,使用MyBatis操作Oracle TimesTen需要配置数据源,定义映射关系和SQL语句,创建会话工厂对象,并通过会话对象执行数据库操作。借助MyBatis的强大功能,我们可以轻松地进行数据库操作,并实现高效、灵活的数据访问。 ### 回答3: MyBatis是一种开源的Java持久层框架,用于简化数据库访问的过程。它可以方便地配置和执行SQL语句,提供了灵活的映射机制,支持主流的关系型数据库。 Oracle TimesTen是一种内存数据库,具有高速的访问和响应能力,适用于对数据访问速度要求较高的场景。在使用MyBatis操作Oracle TimesTen时,我们需要配置相关的数据源和映射文件,以便实现与数据库的连接和数据的CRUD操作。 首先,我们需要在MyBatis的配置文件中配置与Oracle TimesTen的数据源连接信息。可以指定数据库的URL、用户名和密码等信息。同时,还需在配置文件中配置相关的数据源和事务管理器。 然后,我们需要编写SQL映射文件,其中定义了与Oracle TimesTen相关的SQL语句和相关的参数映射。通过配置文件中的映射关系,MyBatis可以将数据库查询结果映射为Java对象,并将Java对象转换为SQL语句的参数。 接下来,我们可以通过MyBatis的API来执行SQL语句和操作数据库。通过使用MyBatis的SQL Session对象,我们可以根据映射文件中的SQL语句进行查询、插入、更新和删除等操作。MyBatis还提供了多种方式来处理事务,以保证数据的一致性和完整性。 在操作Oracle TimesTen时,我们可以利用MyBatis的强大功能来简化开发流程,提高开发效率。通过合理配置数据源和映射文件,并使用MyBatis提供的API进行数据库操作,可以实现高效、灵活和可维护的数据库访问。同时,MyBatis还支持动态SQL语句的生成,能够根据不同的查询条件生成不同的SQL语句,提供了更强大的灵活性。 总之,MyBatis可以很好地支持操作Oracle TimesTen,通过合理配置和使用,能够更方便地与数据库进行交互,并提供了强大的查询和事务管理能力。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值