timesten在Centos6-64下从安装到编程实战
来源:互联网 发布:域名申请免费 编辑:程序博客网 时间:2024/05/17 00:39
安装版本:timesten112190.linux8664
一:安装过程
1.1 系统参数设置
需要使用root登录在 /etc/sysctl.conf文件中设置参数
net.ipv4.tcp_rmem=4096 4194304 4194304
net.ipv4.tcp_wmem=98304 4194304 4194304
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=4194304
net.ipv4.tcp_window_scaling=1
net.ipv4.ip_local_port_range="1024 65000"
如果同台机子上安装了oracle 那么重复的参数可以不再设置
1.2 创建安装用户
# groupadd ttadmin
# useradd -G ttadmin tt
# passwd tt
然后创建安装文件夹,此文件夹名称和位置必须如下:
# mkdir /etc/TimesTen
设置文件夹属主
# chown –R tt:ttadmin /etc/TimesTen
# chmod –R 775 /etc/TimesTen
# chgrp -R ttadmin /etc/TimesTen
1.3 下载gz安装文件,并放置在timesten文件夹下并解压
Tar –xzf 文件名
1.4 设置tt安装用户.bash_profile文件
export ORACLE_BASE=/opt/oracle/app/oracle
export ORACLE_HOME=/opt/oracle/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export TIMESTEN=/home/tt/TimesTen/tt1122
export LD_LIBRARY_PATH=$TIMESTEN/lib:$ORACLE_HOME/lib
export PATH=$TIMESTEN/bin:$ORACLE_HOME/bin:$PATH:$HOME/bin
unset USERNAME
根据实际oracle安装路径和tt安装路径进行修改
1.5 安装tt
进入解压文件夹linux8664
以tt用户运行安装脚本
./setup.sh
安装过程会有很多选项需要用户选择,请根据实际情况进行选择。一般都选择默认。二: 配置DNS 2.1 创建用户在安装结束后,在命令行中输入:[yleesun@centos src]$ ttisql tt_1121Copyright (c) 1996-2011, Oracle. All rights reserved.Type ? or "help" for help, type "exit" to quit ttIsql.connect "DSN=tt_1121";Connection successful: DSN=TT_1121;DataStore=/etc/TimesTen/tt1121/info/TT_1121;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/etc/TimesTen/tt1121/lib/libtten.so;TypeMode=0;(Default setting AutoCommit=1)Command> 则连接成功!接下来,要创建用户!Command> create user svc identified by svc;给用户授权。Command> grant all to svc;2.2 配置本地DNS (直接连接TT,却别与CS模式连接)安装完成后,在$TIMESTEN/info/sys.odbc.ini文件中,生成默认的DNS,默认的名称是TT_1121,此名称可以根据需要修改。#############################################################[TT_1121]Driver=/etc/TimesTen/tt1121/lib/libtten.soDataStore=/etc/TimesTen/tt1121/info/TT_1121DatabaseCharacterSet=US7ASCIIUID=svc ##指定连接时使用到用户名#####################################################################修改完成后,再次使用命令连接TT:[yleesun@centos src]$ ttisql tt_1121Copyright (c) 1996-2011, Oracle. All rights reserved.Type ? or "help" for help, type "exit" to quit ttIsql.connect "DSN=tt_1121";Enter password for 'svc': Connection successful: DSN=TT_1121;UID=svc;DataStore=/etc/TimesTen/tt1121/info/TT_1121;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/etc/TimesTen/tt1121/lib/libtten.so;TypeMode=0;(Default setting AutoCommit=1)Command> 需要输入用户到密码。2.3 配置作为客户端方式连接TT首先需要在$TIMESTEN/info/sys.odbc.ini配置DNS,如下:[tt_196] ## 本地 DNS 名称TTC_SERVER=tt_196 ## tt 服务端所在机器,此信息在下面将做说明。TTC_SERVER_DSN=tt_1122 ## tt 服务端DNS名称UID=svc ## 用户id在$TIMESTEN/info/sys.ttconnect.ini配置tt服务端IP和端口,如下:[tt_196] ## 此名称要和上面的TTC_SERVER指定的一致Description=TimesTen Server ## 描述信息,随便填写Network_Address=192.168.15.196 ## tt 服务端IPTCP_PORT=53397 ## tt 服务端服务端口查看TT服务端口命令:ttstatus[yleesun@centos src]$ ttstatus;TimesTen status report as of Tue Jul 31 10:09:45 2012Daemon pid 2019 port 53388 instance tt1121TimesTen server pid 2027 started on port 53389------------------------------------------------------------------------Data store /etc/TimesTen/tt1121/info/TT_1121There are no connections to the data storeReplication policy : ManualCache Agent policy : ManualPL/SQL enabled.------------------------------------------------------------------------Accessible by group ttEnd of report三:编程指南测试程序#define TT_64BIT // 如果在64位操作系统上使用,切忌别忘了在代码里加上这个宏,不然编译不过。#include "ttclasses/TTConnection.h"#include "ttclasses/TTCmd.h"#include "ttclasses/TTStatus.h"#include <iostream>using namespace std;int show(TTConnection* conn,TTStatus st);int main() { TTCmd cmd; TTStatus stat;try{ TTConnection _connTT; _connTT.Connect("DSN=TT_1121;pwd=svc",stat); if(_connTT.isConnected()) cout << "connect ok!" << endl; else cout<<" connect failed!"<<endl; int aid = -1; cout<<"before insert."<<endl; aid = show(&_connTT,stat); cmd.Prepare(&_connTT,"insert into REL_ANALOG_E(ANALOG_ID,EQUIP_ID,XTU_ID,MEASPOINT_ID) values(:P1,:P2,:P3,:P4)",stat); aid+=1; int eid = 3; int xid = 3; int mid = 1; cmd.setParam(1,aid); cmd.setParam(2,eid); cmd.setParam(3,xid); cmd.setParam(4,mid); cmd.Execute(stat); _connTT.Commit(stat); cmd.Close(stat); cout<<"insert one record successfully!"<<endl; cmd.Prepare(&_connTT,"select ANALOG_ID from REL_ANALOG_E",stat); cmd.Execute(stat); aid = -1; cout<<"after insert."<<endl; aid = show(&_connTT,stat); }catch(TTError st){ cout<<st.err_msg<<endl;} return 0;}int show(TTConnection* conn,TTStatus stat){ int aid = -1; TTCmd cmd; try{ cmd.Prepare(conn,"select ANALOG_ID from REL_ANALOG_E",stat); cmd.Execute(stat); while(cmd.FetchNext(stat) == 0) { cmd.getColumn(1,&aid); cout<<aid<<endl; } } catch(TTError st) { cout<<st.err_msg<<endl; } cmd.Close(stat); return aid;}编译命令:[yleesun@centos src]$ g++ -I$TT_ROOT/include -L$TT_ROOT/lib -lttclasses -o test test.cpp运行:./test[yleesun@centos src]$ ./test connect ok!before insert.100101102103104105106107注:如果在编译时出现类似下面的错误,则原因时,在代码里面没有定义宏:TT_64BIT,在代码里加上此宏,问题解决。/home/yleesun/3rd/TimesTen/include/ttclasses/TTCmd.h:365: error: ‘void TTCmd::getColumn(int, SQLBIGINT*, TTStatus&)’ cannot be overloaded/home/yleesun/3rd/TimesTen/include/ttclasses/TTCmd.h:353: error: with ‘void TTCmd::getColumn(int, long int*, TTStatus&)’/home/yleesun/3rd/TimesTen/include/ttclasses/TTCmd.h:366: error: ‘bool TTCmd::getColumnNullable(int, SQLBIGINT*, TTStatus&)’ cannot be overloaded/home/yleesun/3rd/TimesTen/include/ttclasses/TTCmd.h:355: error: with ‘bool TTCmd::getColumnNullable(int, long int*, TTStatus&)’/home/yleesun/3rd/TimesTen/include/ttclasses/TTCmd.h:367: error: ‘void TTCmd::getColumn(int, SQLBIGINT*)’ cannot be overloaded/home/yleesun/3rd/TimesTen/include/ttclasses/TTCmd.h:357: error: with ‘void TTCmd::getColumn(int, long int*)’/home/yleesun/3rd/TimesTen/include/ttclasses/TTCmd.h:368: error: ‘bool TTCmd::getColumnNullable(int, SQLBIGINT*)’ cannot be overloaded/home/yleesun/3rd/TimesTen/include/ttclasses/TTCmd.h:359: error: with ‘bool TTCmd::getColumnNullable(int, long int*)’/home/yleesun/3rd/TimesTen/include/ttclasses/TTCmd.h:484: error: ‘void TTCmd::getNextColumn(SQLBIGINT*, TTStatus&)’ cannot be overloaded结束!!!
- timesten在Centos6-64下从安装到编程实战
- oracle11gr2在linux上,从安装到编程实战
- TimesTen在linux下的安装
- 在centos6.*下安装PostgreSQL
- Linux下TimesTen的安装
- 在Linux上安装TimesTen
- 在Windows上安装TimesTen
- 在nodejs下express 从安装到运行的全过程
- 在centos6.0下安装xen
- 在centos6.3下安装wireshark
- 在centos6.4下安装虚拟机软件
- 在win7下硬盘安装centos6.5
- 在centOS6.5下安装flash插件
- 在centos6.5下安装vmware tools
- 在centos6.5下安装tesseract3.02
- 在Centos6.5下安装CMake2.8
- keepalived在Centos6.5下安装配置
- 如何在centos6.5下安装wxPython
- 联合(union)用法
- jboss下将日志文件输出到不同文件
- 浏览器兼容问题
- iZettle被迫停止Visa支付功能 幕后黑手或为死敌Square
- Microsoft Office SharePoint Server 2007 Remote Code Execution
- timesten在Centos6-64下从安装到编程实战
- Objective-C的self.用法的一些总结
- ubuntu nfs 安装
- VS.net中DirectShow Filter调试方法!~
- StringOpt
- cgi表单的处理
- 北大ACM poj1248 Safecracker
- Math.net之矩阵运算
- 如何在linux下安装Oracle 客户端